home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / copro15a.zip / COPRO15.TXT next >
Text File  |  1993-01-14  |  251KB  |  4,531 lines

  1.  
  2.  
  3.          EVERYTHING YOU ALWAYS WANTED TO KNOW ABOUT MATH COPROCESSORS
  4.  
  5. This document has been created to provide the net.community with some
  6. detailed information about mathematical coprocessors for the Intel 80x86 CPU
  7. family. It may also help to answer some of the FAQs (frequently asked
  8. questions) about this topic. The primary focus of this document is on 80387-
  9. compatible chips, but there is also some information on the other chips in
  10. the 80x87 family and the Weitek family of coprocessors. Care was taken to
  11. make the information included as accurate as possible. If you think you have
  12. discovered erroneous information in this text, or think that a certain detail
  13. needs to be clarified, or want to suggest additions, feel free to contact me
  14. at:
  15.  
  16.          S_JUFFA@IRAVCL.IRA.UKA.DE
  17.  
  18.          or at my SnailMail address:
  19.  
  20.          Norbert Juffa
  21.          Wielandtstr. 14
  22.          7500 Karlsruhe 1
  23.          Germany
  24.  
  25.  
  26. This is the fifth version of this document (dated 01-13-93) and I'd like
  27. to thank those who have helped improving it by commenting on the previous
  28. versions:
  29.  
  30.          Fred Dunlap (cyrix!fred@texsun.Central.Sun.COM), Peter Forsberg
  31.          (peter@vnet.ibm.com), Richard Krehbiel (richk@grevyn.com), Arto
  32.          Viitanen (av@cs.uta.fi), Jerry Whelan (guru@stasi.bradley.edu),
  33.          Eric Johnson (johnson%camax01@uunet.UU.NET), Warren Ferguson
  34.          (ferguson@seas.smu.edu), Bengt Ask (f89ba@efd.lth.se), Thomas Hoberg
  35.          (tmh@prosun.first.gmd.de), Nhuan Doduc (ndoduc@framentec.fr), John
  36.          Levine (johnl@iecc.cambridge.ma.us), David Hough (dgh@validgh.com),
  37.          Duncan Murdoch (dmurdoch@mast.QueensU.CA), Benjamin Eitan
  38.          (benny.iil.intel.com)
  39.  
  40. A very special thanks goes to David Ruggiero (osiris@halcyon.halcyon.com),
  41. who did a great job editing and formatting this article. Thanks David!
  42.  
  43.  
  44. Contents of this document
  45. -------------------------
  46.  
  47. 1)  What are math coprocessors?
  48. 2)  How PC programs use a math coprocessor
  49. 3)  Which applications benefit from a math coprocessor
  50. 4)  Potential performance gains with a math coprocessor
  51. 5)  How various math coprocessors work
  52. 6)  Coprocessor emulator software
  53. 7)  Installing a math coprocessor
  54. 8)  Detailed description and specifications for all available math
  55.     coprocessor chips
  56. 9)  Finding out which coprocessor you have (the COMPTEST program)
  57. 10) Current coprocessor prices and purchasing advice
  58. 11) The coprocessor benchmark programs (performance comparisons of
  59.     available math coprocessors using various CPUs)
  60. 12) Clock-cycle timings for each coprocessor instruction
  61. 13) Accuracy tests and IEEE-754 conformance for various coprocessors
  62. 14) Accuracy of transcendental function calculations for various coprocessors
  63. 15) Compatibility tests with Intel's 387DX / the SMDIAG program
  64. 16) References (literature)
  65. 17) Addresses of manufacturers of math coprocessors
  66. 18) Appendix A: Test programs for partial compatibility and accuracy checks
  67. 19) Appendix B: Benchmark programs TRNSFORM and PEAKFLOP
  68.  
  69.  
  70.  
  71. ===========================
  72. What are math coprocessors?
  73. ===========================
  74.  
  75. A coprocessor in the traditional sense is a processor, separate from the main
  76. CPU, that extends the capabilities of a CPU in a transparent manner. This
  77. means that from the program's (and programmer's) point of view, the CPU and
  78. coprocessor together look like a single, unified machine.
  79.  
  80. The 80x87 family of math coprocessors (also known as MCPs [Math
  81. CoProcessors], NDPs [Numerical Data Processors], NPXs [Numerical Processor
  82. eXtensions], or FPUs [Floating-Point Units], or simply "math chips") are
  83. typical examples of such coprocessors. The 80x86 CPUs, with the exception of
  84. the 80486 (which has a built-in FPU) can only handle 8, 16, or 32 bit
  85. integers as their basic data types. However, many PC-based applications
  86. require the use of not only integers, but floating-point numbers. Simply put,
  87. the use of floating-point numbers enables a binary representation of not only
  88. integers, but also fractional values over a wide range. A common application
  89. of floating-point numbers is in scientific applications, where very small
  90. (e.g., Planck's constant) and very large numbers (e.g., speed of light) must
  91. be accurately expressed. But floating-point numbers are also useful for
  92. business applications such as computing interest, and in the geometric
  93. calculations inherent in CAD/CAM processing.
  94.  
  95. Because the instruction sets of all 80x86 CPUs directly support only integers
  96. and calculations upon integers, floating-point numbers and operations on them
  97. must be programmed indirectly by using series of CPU integer instructions.
  98. This means that computations when floating-point numbers are used are far
  99. slower than normal, integer calculations. And this is where the 80x87
  100. coprocessors come in: adding an 80x87 to an 80x86-based system augments the
  101. CPU architecture with eight floating-point registers, five additional data
  102. types and over 70 additional instructions, all designed to deal directly with
  103. floating-point numbers as a basic data type. This removes the 'penalty' for
  104. floating-point computations, and greatly increases overall system performance
  105. for applications which depend heavily on these calculations.
  106.  
  107. In addition to being able to quickly execute load/store operations on
  108. floating-point numbers, the 80x87 coprocessors can directly perform all the
  109. basic arithmetic operation on them. Besides "knowing" how to add, subtract,
  110. multiply and divide floating-point numbers, they can also operate on them to
  111. perform comparisons, square roots, transcendental functions (such as logarithms
  112. and sine/cosine/tangent), and compute their absolute value and remainder.
  113.  
  114. Like most things in life, floating-point arithmetic has been standardized.
  115. The relevant standard (to which I will refer quite often in this document) is
  116. the "IEEE-754 Standard for Binary Floating-Point Arithmetic" [10,11]. The
  117. standard specifies numeric formats, value sets and how the basic arithmetic
  118. (+,-,*,/,sqrt, remainder) has to work. All the coprocessors covered in this
  119. document claim full or at least partial compliance with the IEEE-754
  120. standard.
  121.  
  122.  
  123.  
  124. =================================================
  125. How PC programs use 80x87 and Weitek coprocessors
  126. =================================================
  127.  
  128. The basic data type used by all 80x87 coprocessors is an 80-bit long
  129. floating-point number. This data type (called "temporary real" or "double
  130. extended precision") can directly represent numbers which range in size
  131. between 3.36*10^-4932 and 1.19*10^4932 (3.65*10^-4951 to 1.19*10^4932
  132. including denormal numbers) where '^' denotes the power operator. (For those
  133. familiar with floating-point formats, this format has 64 mantissa bits, 15
  134. exponent bits and 1 sign bit, for the total of 80 bits.) This format provides
  135. a precision of about 19 decimal places. 80x87s can also handle additional
  136. data types that are converted to/from the internal format upon being loaded
  137. or stored to/from the coprocessor. These include 16 bit, 32 bit, and 64 bit
  138. integers as well as a 18 digit BCD (binary coded decimal) data type occupying
  139. 10 bytes and providing 18 decimal digits.
  140.  
  141. The 80x87 also supports two additional floating-point types. The short real
  142. data type (also called "single-precision") has 32 bits that split into 23
  143. mantissa bits, 8 exponent bit and a sign bit. By using the "hidden bit"
  144. technique, the effective length of the mantissa is increased to 24 bits. (The
  145. hidden bit technique exploits the fact that for normalized floating-point
  146. numbers, the mantissa m always is in the range 1 <= m < 2. Since the first
  147. mantissa bit represents the integer part of the mantissa, it is always set
  148. for normalized numbers, and therefore need not be stored, as it is guaranteed
  149. to always be 1.) The IEEE single-precision format provides a precision of
  150. about 6-7 decimal places and can represent numbers between 1.17*10^-38 and
  151. 3.40*10^38 (1.40*10^-45 to 3.40*10^38 including denormal numbers). The long
  152. real, or double-precision, data type has 64 bits, consisting of 52 mantissa
  153. bits, 11 exponent bits, and the sign bit. It provides 15-16 decimal digits of
  154. precision and can handle numbers from 2.22*10^-308 to 1.79*10^308 (4.94*10^-
  155. 324 to 1.79*10^308 including denormal numbers). (This format also uses the
  156. hidden bit technique to provide effectively 53 mantissa bits.)
  157.  
  158. The eight registers in the 80x87 are organized in a stack-like manner which
  159. takes some time getting used to if one programs the coprocessor directly in
  160. assembly language. However, nowadays the compilers or interpreters for most
  161. high level languages (HLLs) can give a programmer easy access to the
  162. coprocessor's data types and use their instructions, so there is not much
  163. need to deal directly with the rather unusual architecture of the 80x87.
  164.  
  165.  
  166. The architecture of the Weitek chips differs significantly from the 80x87.
  167. Strictly speaking, the Weitek Abacus 3167 and 4167 are not coprocessors in
  168. that they do not transparently extend the CPU architecture; rather, they
  169. could be described as highly-specialized, memory-mapped IO devices. But as
  170. the term "coprocessor" has been traditionally used for these chips, they will
  171. be referred to as such here.
  172.  
  173. The Weitek coprocessors have a RISC-like architecture which has been tuned
  174. for maximum performance. Only a small instruction set has been implemented in
  175. the chip, but each instruction executes at a very high speed (usually only a
  176. few clock cycles each). Instructions available include load/store, add,
  177. subtract, subtract reverse, multiply, multiply and negate, multiply and
  178. accumulate, multiply and take absolute value, divide reverse, negate,
  179. absolute value, compare/test, convert fix/float, and square root. In contrast
  180. to the 80x87 family, the Weitek Abacus does not support a double extended
  181. format, has no built-in transcendental functions, and does not support
  182. denormals. The resources required to implement such features have instead
  183. been devoted to implement the basic arithmetic operations as fast as
  184. possible.
  185.  
  186. While the 80x87 coprocessors perform all internal calculations in double
  187. extended precision and therefore have about the same performance for single
  188. and double-precision calculations, the Weitek features explicit single and
  189. double-precision operations. For applications that require only single-
  190. precision operations, the Weitek can therefore provide very high performance,
  191. as single-precision operations are about twice as fast as their double-
  192. precision counterparts. Also, since the Weitek Abacus has more registers than
  193. the 80x87 coprocessors (31 versus 8), values can be kept in registers more
  194. often and have to be loaded from memory less frequently. This also leads to
  195. performance gains.
  196.  
  197. The Weitek's register file consists of 31 32-bit registers, each one capable
  198. of holding an IEEE single-precision number. Pairs of consecutive single-
  199. precision registers can also be used as 64-bit IEEE double-precision
  200. registers; thus there are 15 double-precision registers. The Weitek register
  201. file has the standard organization like the register files in the 80386, not
  202. the special stack-like organization of the 80x87 coprocessors.
  203.  
  204. To the main CPU, the Weitek Abacus appears as a 64 KB block of memory
  205. starting at physical address 0C0000000h. Each address in this range
  206. corresponds to a coprocessor instruction. Accessing a specified memory
  207. location within this block with a MOV instruction causes the corresponding
  208. Weitek instruction to be executed. (The instructions have been cleverly
  209. assigned to memory locations in such a way that loads to consecutive
  210. coprocessor registers can make use of the 386/486 MOVS string instruction.)
  211. This memory-mapped interface is much faster than the IO-oriented protocol
  212. that is used to couple the CPU to an 80287 or 80387 coprocessor. The Weitek's
  213. memory block can actually be assigned to any logical address using the MMU
  214. (memory management unit) in the 386/486's protected and virtual modes. This
  215. also means that the Weitek Abacus *cannot* be used in the real mode of those
  216. processors, since their physical starting address (0C0000000h) is not within
  217. the 1 MByte address range and the MMU is inoperable in real mode. However,
  218. DOS programs can make use of the Weitek by using a DOS extender or a memory
  219. manager (such as QEMM or EMM386) that runs in protected/virtual mode itself
  220. and can therefore map the Weitek's memory block to any desired location in
  221. the 1 MByte address range.
  222.  
  223. Typically the FS segment register is then set up to point to the Weitek's
  224. memory block. On the 80486, this technique has severe drawbacks, as using the
  225. FS: prefix takes an additional clock cycle, thereby nearly halving the
  226. performance of the 4167. Most DOS-based compilers exhibit this problem, so
  227. the only way around it is to code in assembly language [75]. The Weitek
  228. Abacus 3167 and 4167 are also supported by the UNIX operating system [33].
  229.  
  230.  
  231.  
  232. ==========================================================
  233. Which application programs benefit from a math coprocessor
  234. ==========================================================
  235.  
  236. According to the Intel 387DX User's Guide, there are more than 2100
  237. commercial programs that can make use of a 387-compatible coprocessor. Every
  238. program that uses floating-point arithmetic somewhere and contains the
  239. instructions to support an 80x87 or Weitek chip can gain speed by installing
  240. one. However, the speedup will vary from program to program (and even within
  241. the same program) depending on how computation-intensive the program or
  242. operation within the program is. Typical applications that benefit from the
  243. use of a math coprocessor are:
  244.  
  245.    - CAD programs (AutoCAD, VersaCAD, GenericCAD)
  246.    - Spreadsheet programs (Lotus 1-2-3, Excel, Quattro, Wingz)
  247.    - Business graphics programs (Arts&Letters, Freedom of Press, Freelance)
  248.    - Mathematical analysis and statistical programs (Mathematica, TKSolver,
  249.        SPSS/PC, Statgraphics)
  250.    - Database programs (dBase IV, FoxBase, Paradox, Revelation)
  251.  
  252. Note that for spreadsheets and databases, a coprocessor only helps if some
  253. kind of floating-point computation is performed; this is true more often for
  254. spreadsheets than for databases. Also note that the speed of many programs
  255. depends quite heavily on factors such the speed of the graphics adapter (CAD)
  256. or the disk performance (databases), so the computational performance is only
  257. a (small) part of the total performance of the application. There are some
  258. programs that won't run without a coprocessor, among them AutoCAD (R10 and
  259. later) and Mathematica.
  260.  
  261. Most GUIs (graphical user interfaces) such as Microsoft Windows or the OS/2
  262. Presentation Manager do *not* gain additional speed from using a
  263. *mathematical* coprocessor, since their graphics operations only use integer
  264. arithmetic [71]. They *will* benefit from a graphics board with a graphics
  265. "coprocessor" that speeds up certain common graphics operations such as
  266. BitBlt or line drawing. A few GUIs used on PCs, such as X-Windows, use a
  267. certain amount of floating-point operations for operations such as arc
  268. drawing. However, the use of floating-point operations in X-Windows seems to
  269. have decreased significantly in versions after X11R3, so the overall
  270. performance impact of a coprocessor is small [72]. Applications running under
  271. any GUI may take advantage of a math coprocessor, of course (for example,
  272. Microsoft Excel running under Windows).
  273.  
  274. While support for 80x87 coprocessors is very common in application programs,
  275. the Weitek Abacus coprocessors do not enjoy such widespread support. Due to
  276. their higher price, only a few high-end PCs have been equipped with Weitek
  277. coprocessors. Some machines, such as IBM's PS/2 series, do not even have
  278. sockets to accommodate them. Therefore, most of the programs that support
  279. these coprocessors are also high-end products, like AutoCAD and Versacad-386.
  280.  
  281.  
  282.  
  283. ==============================================
  284. Potential performance gains with a coprocessor
  285. ==============================================
  286.  
  287. The Intel Math Coprocessor Utilities Disk that accompanies the Intel 387DX
  288. coprocessor has a demonstration program that shows the speedup of certain
  289. application programs when run with the Intel coprocessor versus a system with
  290. no coprocessor:
  291.  
  292.          Application       Time w/o 387   Time w/387    Speedup
  293.  
  294.          Art&Letters          87.0 sec      34.8 sec     150%
  295.          Quattro Pro           8.0 sec       4.0 sec     100%
  296.          Wingz                17.9 sec       9.1 sec      97%
  297.          Mathematica         420.2 sec     337.0 sec      25%
  298.  
  299.  
  300.          The following table is an excerpt from [70]:
  301.  
  302.          Application        Time w/o 387   Time w/387  Speedup
  303.  
  304.          Corel Draw          471.0 sec     416.0 sec      13%
  305.          Freedom Of Press    163.0 sec      77.0 sec     112%
  306.          Lotus 1-2-3         257.0 sec      43.0 sec     597%
  307.  
  308.  
  309.          The following table is an excerpt from [25]:
  310.  
  311.          Application        Time w/o 387   Time w/387  Speedup
  312.  
  313.          Design CAD, Test1    98.1 sec      50.0 sec      96%
  314.          Design CAD, Test2    75.3 sec      35.0 sec     115%
  315.          Excel, Test 1         9.2 sec       6.8 sec      35%
  316.          Excel, Test 1        12.6 sec       9.3 sec      35%
  317.  
  318.  
  319. Note that coprocessor performance also depends on the motherboard, or more
  320. specifically, the chipset used on the motherboard. In [34] and [35]
  321. identically configured motherboards using different 386 chipsets were tested.
  322. Among other tests a coprocessor benchmark was run which is based on a fractal
  323. computation and its execution time recorded. The following tables showing
  324. coprocessor performance to vary with the chipset have been copied from these
  325. articles in abridged form:
  326.  
  327.                   Cyrix                                   Cyrix
  328.     chip set      387+                 chip set           83D87
  329.  
  330.     Opti, 40 MHz  24.57 sec   97.0%    PC-Chips, 33 MHz  26.97 sec   93.0%
  331.     Elite,40 MHz  24.46 sec   97.4%    UMC,      33 MHz  27.69 sec   90.5%
  332.     ACT,  40 MHz  23.84 sec  100.0%    Headland, 33 MHz  25.08 sec  100.0%
  333.     Forex,40 MHz  23.84 sec  100.0%    Eteq,     33 MHz  27.38 sec   91.6%
  334.  
  335.  
  336. This shows that performance of the same coprocessor can vary by up to ~10%
  337. depending on the chipset used on your board, at least for 386 motherboards
  338. (similar numbers for 286, 386SX, and 486 are, unfortunately, not available).
  339. The benchmarks for this article were run on a motherboard with the Forex chip
  340. set, one of the fastest 386 chip sets available, and not only with respect to
  341. floating-point performance [35].
  342.  
  343.  
  344.  
  345. ==================================
  346. How various math coprocessors work
  347. ==================================
  348.  
  349. In any 80x86 system with an 80x87 math coprocessor, CPU instructions and
  350. coprocessor instructions are executed concurrently. This means that the CPU
  351. can execute CPU instructions while the coprocessor executes a coprocessor
  352. instruction at the same time. The concurrency is restricted somewhat by the
  353. fact that the CPU has to aid the coprocessor in certain operations. As the
  354. CPU and the coprocessor are fed from the same instruction stream and both
  355. instruction streams may operate on the same data, there has to be a
  356. synchronizing mechanism between the CPU and the coprocessor.
  357.  
  358.  
  359. The 8087
  360. --------
  361. In 8086/8088 systems with 8087 coprocessors, both chips look at every opcode
  362. coming in from the bus. To do this, both chips have the same BIU (bus
  363. interface unit) and the 8086 BIU sends the status signals of its prefetch
  364. queue to the 8087 BIU. This insures that both processors always decode the
  365. same instructions in parallel. Since all coprocessor instruction start with
  366. the bit pattern 11011, it is easy for the 8087 to ignore all other
  367. instructions. Likewise the CPU ignores all coprocessor instructions, unless
  368. they access memory. In this case, the CPU computes the address of the LSB
  369. (least significant byte) of the memory operand and does a dummy read. The
  370. 8087 then takes the data from the data bus. If more than one memory access is
  371. needed to load an memory operand, the 8087 requests the bus from the CPU,
  372. generates the consecutive addresses of the operand's bytes and fetches them
  373. from the data bus. After completing the operation, the 8087 hands bus control
  374. back to the CPU. Since 8087 and CPU are hooked up to the same synchronous
  375. bus, they must run at the same speed. This means that with the 8087, only
  376. synchronous operation of CPU and coprocessor is possible.
  377.  
  378. Another 8087 coprocessor instruction can only be started if the previous one
  379. has been completed in the NEU (numerical execution unit) of the 8087. To
  380. prevent the 8086 from decoding a new coprocessor instruction while the 8087
  381. is still executing the previous coprocessor instruction, a coding mechanism
  382. is employed:  All 8087-capable compilers and assemblers automatically
  383. generate a WAIT instruction before each coprocessor instruction. The WAIT
  384. instruction tests the CPU's /TEST pin and suspends execution until its input
  385. becomes "LOW". In all 8086/8087 systems, the 8086 /TEST pin is connected to
  386. the 8087 BUSY pin. As long as the NEU executes a coprocessor instruction, it
  387. forces its BUSY pin "HIGH"; thus, the WAIT opcode preceding the coprocessor
  388. instruction stops the CPU until any still-executing coprocessor instruction
  389. has finished.
  390.  
  391. The same synchronization is used before the CPU accesses data that was
  392. written by the coprocessor. A WAIT instruction after any coprocessor
  393. instruction that writes to memory causes the CPU to stop until the
  394. coprocessor has completed transfer of the data to memory, after which the CPU
  395. can safely access it.
  396.  
  397.  
  398. The 80287
  399. ---------
  400. The 80287 coprocessor-CPU interface is totally different from the 8087
  401. design. Since the 80286 implements memory protection via an MMU based on
  402. segmentation, it would have been much too expensive to duplicate the whole
  403. memory protection logic on the coprocessor, which an interface solution
  404. similar to the 8087 would have required. Instead, in an 80286/80287 system,
  405. the CPU fetches and stores all opcodes and operands for the coprocessor.
  406. Information is then passed through the CPU ports F8h-FFh. (As these ports are
  407. accessible under program control, care must be taken in user programs not to
  408. accidentally perform write operations to them, as this could corrupt data in
  409. the math coprocessor.)
  410.  
  411. The 8087/8087 combination can be characterized as a cooperation of partners
  412. with equal rights, while the 80286/287 is more a master-slave relationship.
  413. This makes synchronization easier, since the complete instruction and data
  414. flow of the coprocessor goes through the CPU. Before executing most
  415. coprocessor instructions, the 80286 tests its /BUSY pin, which is tied to the
  416. 287 coprocessor and signals if the 80287 is still executing a previous
  417. coprocessor instruction or has encountered an exception. The 80286 then waits
  418. until the /BUSY signal goes to "low" before loading the next coprocessor
  419. instruction into the 80287. Therefore, a WAIT instruction before every
  420. coprocessor instruction is not required. These WAITs are permissible, but not
  421. necessary, in 80287 programs. The second form of WAIT synchronization (after
  422. the coprocessor has written a memory operand) *is* still necessary on 286/287
  423. systems.
  424.  
  425. The execution unit of the 80287 is practically identical to that of the 8087;
  426. that is, nearly all coprocessor instructions execute in the same number of
  427. clock cycles on both coprocessors. However, due to the additional overhead of
  428. the 80287's CPU/coprocessor interface (at least ~40 clock cycles), an 8 MHz
  429. 80286/80287 combination can have lower floating-point performance than an
  430. 8086/8087 system running at the same speed. Additionally, older 286 boards
  431. were often configured to run the coprocessor at only 2/3 the speed of the
  432. CPU, making use of the ability of the 80287 to run asynchronously: The 80287
  433. has a CKM pin that causes the incoming system clock to be divided by three
  434. for the coprocessor if it is tied to ground. The 80286 always divides the
  435. system clock by two internally, hence the final ratio of 2/3. However, when
  436. the CKM (ClocK Mode) pin is tied high on the 80287, it does not divide the
  437. CLK input. This feature has been exploited by the maker of coprocessor speed
  438. sockets. These sockets tie CKM high and supply their own CLK signal with a
  439. built-in oscillator, thereby allowing the 80287 or compatible to run at a
  440. much higher speed than the CPU. With an IIT or Cyrix 287 one can have a 20
  441. MHz coprocessor running with a 8 MHz 80286! Note, however, that the floating-
  442. point performance of such a configuration does not scale linearly with the
  443. coprocessor clock, since all the data has to be passed through the much
  444. slower CPU. If the coprocessor executes mostly simple instructions (such as
  445. addition and multiplication), doubling the coprocessor clock to 20 MHz in a
  446. 10 MHz system does not show any performance increase at all [24].
  447.  
  448. The Intel 80287XL, the Cyrix 82S87, and the IIT 2C87 contain the internals of
  449. a 387 coprocessor, but are pin-compatible to the original 287. These chips
  450. divide the system clock by two internally, as opposed to three in the
  451. original 80287. Since the 80286 also divides the system clock by two, they
  452. usually run synchronously with respect to the CPU, although they can also be
  453. run asynchronously.
  454.  
  455.  
  456. The 80387
  457. ---------
  458. The coprocessor interface in 80386/80387 systems is very similar to the one
  459. found in 286/287 systems. However, to prevent corruption of the coprocessor's
  460. contents by programming errors, the IO ports 800000F8h-800000FFh are used,
  461. which are not accessible to programs. The CPU/coprocessor interface has been
  462. optimized and uses full 32-bit transfers; the interface overhead has been
  463. reduced to about 14-20 clock cycles. For some operations on the 387 'clones'
  464. that take less than about 16 clock cycles to complete, this overhead
  465. effectively limits the execution rate of coprocessor instructions. The only
  466. sensible solution to provide even higher floating-point performance was to
  467. integrate the CPU and coprocessor functionality onto the same chip, which
  468. is exactly what Intel did with the 80486 CPU. The FPU in the 486 also benefits
  469. from the instruction pipelining and from the on-chip cache.
  470.  
  471.  
  472.  
  473. =====================
  474. Coprocessor emulators
  475. =====================
  476.  
  477. In the absence of a coprocessor, floating-point calculations are often
  478. performed by a software package that simulates its operations. Such a program
  479. is called a coprocessor emulator. Simulating the coprocessor has the
  480. advantage for application programs that identical code can be generated for
  481. use with either the coprocessor and the emulator, so that it's possible to
  482. write programs that run on any system without regard to whether a coprocessor
  483. is present or not. Whether the program will use an actual coprocessor or
  484. software emulating it can easily be determined at run-time by detecting the
  485. presence or absence of the coprocessor chip.
  486.  
  487. Two approaches to interface an 80x87 emulator to programs are common. The
  488. first method makes use of the fact that all coprocessor instruction start
  489. with the same five bit pattern 11011. Thus the first byte of a coprocessor
  490. instruction will be in the range D8-DF hexadecimal. In addition, coprocessor
  491. instructions usually are preceded by a WAIT instruction (opcode 9Bh) which is
  492. one byte long (the reason for doing this has been described in the previous
  493. chapter dealing with the operating details of the 80x87). One common approach
  494. is to replace the WAIT instruction and the first byte of the coprocessor
  495. instruction with one out of eight interrupt instructions; the remaining bytes
  496. of the coprocessor instruction are left unchanged. Interrupts 34 to 3B
  497. hexadecimal are used for this emulation technique. (Note that the sequences
  498. 9B D8 ... 9B DF can be easily converted to the interrupt instructions CD 34
  499. ... CD 3B by simple addition and subtraction of constants.) The compiler or
  500. assembler initially produces code that contains these appropriate interrupt
  501. calls instead of the coprocessor instructions. If a hardware coprocessor is
  502. detected at run-time, the emulator interrupts point to a short routine that
  503. converts the interrupts calls back to coprocessor instructions (yes, this
  504. is known as "self-modifying code"). If no coprocessor is found the interrupts
  505. point to the emulation package, which examines the byte(s) following the
  506. interrupt instruction to determine which floating-point operation to perform.
  507. This method is used by many compilers, including those from Microsoft and
  508. Borland. It works with every 80x86 CPU from the 8086/8088 on.
  509.  
  510. The second method to interface an emulator is only available on 286/386/486
  511. machines. If the emulation bit in the machine status word of these processors
  512. is set, the processors will generate an interrupt 7 whenever a coprocessor
  513. instruction is encountered. The vector for this interrupt will have been set
  514. up to point at an emulation package that decodes the instruction and performs
  515. the desired operation. This approach has the advantage that the emulator
  516. doesn't have to be included in the program code, but can be loaded once (as a
  517. TSR or device driver) and then used by every program that requires a
  518. coprocessor. Emulation via interrupt 7 is transparent, which means that
  519. programs containing coprocessor instructions execute just like a coprocessor
  520. was present, only slower. This approach is taken by the public domain EM87
  521. emulator, the shareware program Q387, and the commercial Franke387 emulator,
  522. for example. Even programs that require a coprocessor to run like AutoCAD
  523. are 'fooled' to believe that a coprocessor is present with emulators using
  524. INT 7.
  525.  
  526. Operating systems such as OS/2 2.0 and Windows 3.1 provide coprocessor
  527. emulations using INT 7 automatically if they do not find a coprocessor to be
  528. installed. The emulator in Windows doesn't seem to be very fast, as people
  529. who have ported their Turbo Pascal programs from the TP 6.0 DOS compiler
  530. (using the emulation built into the TP 6.0 run-time library) to the TPW 1.5
  531. Windows compiler (using MS Windows' emulator) have noticed. Slowdowns of as
  532. much as a factor of five have been reported [79].
  533.  
  534. The size of the emulator used by TP 6.0 is about 9.5 KB, while EM87 occupies
  535. about 15.8 KB as a TSR, and Franke387 uses about 13.4 KB as a device driver.
  536. Note that Franke387 and especially EM87 model a real coprocessor much more
  537. closely than Turbo Pascal's emulator does. In particular, EM87 supports
  538. denormal numbers, precision control, and rounding control. The emulator in TP
  539. 6.0 does not implement these features. The version of Franke387 tested (V2.4)
  540. supports denormals in single and double-precision, but not double extended
  541. precision, and it supports precision control, but not rounding control.
  542. The recently introduced shareware program Q387 only runs on 386, 386SX, 486SX
  543. and compatible processors. The program loads completely into extended memory
  544. and uses about 330 KB. To enable INT 7 trapping to a service routine in
  545. extended memory it needs to run with a memory manager (e.g. EMM386, QEMM,
  546. or 386MAX). The huge size of the program stems from the fact that it was
  547. solely optimized for speed, assuming that extended memory is a cheap resource.
  548. Presumably it uses large tables to speed computations. Intel's E80287 program
  549. is supposed to be an 100% exact emulation of the 80287 coprocessor [44]. Note
  550. that the more closely a real coprocessor is modelled by the emulator, the
  551. slower the emulator runs and the larger the code for the emulator gets.
  552.  
  553.  
  554.          Relative execution times of coprocessor vs. software emulators
  555.          for selected coprocessor instructions
  556.  
  557.                         Intel 387DX    TP 6.0 Emulator   EM87 Emulator
  558.  
  559.          FADD ST, ST(0)       1              26                104
  560.          FDIV [DWord]         1              22                136
  561.          FXAM                 1              10                 73
  562.          FYL2X                1              33                102
  563.          FPATAN               1              36                110
  564.          F2XM1                1              38                110
  565.  
  566.  
  567.  
  568.          The following table is an excerpt from [44]:
  569.  
  570.                         Intel 80287  Intel E80287 Emulator
  571.  
  572.          FADD ST, ST(0)       1              42
  573.          FDIV [DWord]         1             266
  574.          FXAM                 1             139
  575.          FYL2X                1              99
  576.          FPATAN               1             153
  577.          F2XM1                1              41
  578.  
  579.  
  580.  
  581.          The following has been adapted from [43] and merged with my own
  582.          data:
  583.  
  584.                         Intel 8087  TP 6.0 Emul. (8086)  Intel Emul. (8086)
  585.  
  586.          FADD ST, ST(0)       1              20                 94
  587.          FDIV [DWord]         1              22                 82
  588.          FPTAN                1              18                144
  589.          F2XM1                1               6                171
  590.          FSQRT                1              44                544
  591.  
  592.  
  593.  
  594. One of the reasons emulators are so slow is that they are often designed to
  595. run with every CPU from the 8086/8088 on upwards. This is the case with the
  596. emulators built into the compiler libraries of the Turbo Pascal 6.0 (also
  597. used by Turbo C/C++) and Microsoft C 6.0 compiler (probably also used in
  598. other Microsoft products) and is also true for the EM87 emulator in the
  599. public domain. By using code that can run on a 8086/8088, these emulators
  600. forego the speed advantage offered by the additional instructions and
  601. architectural enhancements (such as 32-bit registers) of the more advanced
  602. Intel 80x86 processors. A notable exception to this is the Franke387
  603. emulator, a commercial emulator that is also sold as shareware. It uses 386-
  604. specific 32-bit code and only runs on 386/386SX/486SX computers.
  605.  
  606. Besides being slow, coprocessor emulators have other drawbacks when compared
  607. with real coprocessors. Most of the emulators do not support the additional
  608. instructions that the 387-compatible coprocessors offer over the 80287.
  609. Often, some of the low-level stack-manipulating instructions like FDECSTP are
  610. not emulated. For example, [76] lists the coprocessor instructions not
  611. emulated by Microsoft's emulator (included in the MS-C and MS-FORTRAN
  612. libraries) as follows:
  613.  
  614.          FCOS         FRSTOR      FSINCOS      FXTRACT
  615.          FDECSTP      FSAVE       FUCOM
  616.          FINCSTP      FSETPM      FUCOMP
  617.          FPREM1       FSIN        FUCOMPP
  618.  
  619. Additionally, some parts of the coprocessor architecture, like the status
  620. register, are often not or only partially emulated. Some emulators do not
  621. conform to the IEEE-754 standard in their implementation of the basic
  622. arithmetic functions, while the hardware coprocessors do. Also, they
  623. sometimes lack the support for denormals (a special class of floating-point
  624. numbers) although it is required by the standard. Not all the 80x87 emulators
  625. support rounding control and precision control, also features required by
  626. IEEE-754. Most of these omissions are aimed at making the emulator faster and
  627. smaller. Because of the performance gap and these other shortcomings of
  628. coprocessor emulators, a real coprocessor is a must for anybody planning to
  629. do some serious computations. (At today's prices, this shouldn't pose much of
  630. a problem to anybody!)
  631.  
  632. Nhuan Doduc (ndoduc@framentec.fr) has tested a number of standalone
  633. coprocessor emulators for PCs, among them the two emulators, EM87 and
  634. Franke387 V2.4, already mentioned. He found Franke387 to be the best in terms
  635. of reliability, speed, and accuracy.
  636.  
  637.  
  638.  
  639. =============================
  640. Installing a math coprocessor
  641. =============================
  642.  
  643. Usually, installing a coprocessor doesn't pose much of a problem, as every
  644. coprocessor comes with installation instructions and a diagnostic disk that
  645. lets you check its correct operation after installation. In addition, the
  646. user manuals of most computers have a section on coprocessor installation.
  647.  
  648. 1)   Make sure to buy the right coprocessor for your system. An 8087 works
  649.      together with 8086, 8088, V20, and V30 CPUs. An 80287, 287XL or
  650.      compatible works with a 80286 CPU. (There are also some old 386
  651.      motherboards that accept a 80287 coprocessor, but they usually also
  652.      provide a socket for the 387; given today's pricing, it makes no sense
  653.      not to get a 387 for these systems.) A 80387, 387DX or compatible
  654.      coprocessor is for 386-based systems, as is the Intel RapidCAD. 387
  655.      coprocessors also work with the Cyrix 486DLC CPU (which, despite its
  656.      name, does not include an FPU). Similarly, the 387SX or compatible
  657.      coprocessor go into systems whose CPU is a 386SX or Cyrix 486SLC.
  658.  
  659.      The Weitek Abacus 3167 works with a 386 CPU but requires a 121-pin EMC
  660.      socket in the system; this is *not* the same socket used by a 80387 or
  661.      compatible chip, and some computers, such as IBM's PS/2s, don't have
  662.      this socket. The Weitek Abacus 4167 works together with the 486 and
  663.      requires a special 142-pin socket to be present.
  664.  
  665. 2)   Always install a coprocessor that's rated at the same clock speed as the
  666.      CPU. For example, in a 40 MHz 386 system using an AMD Am386-40, install
  667.      a coprocessor rated for 40 MHz such as a Cyrix 83D87-40, C&T 38700DX-40,
  668.      IIT 3C87-40, or ULSI 83C87-40. Running a coprocessor above its specified
  669.      frequency rating may cause it to produce false results, which you might
  670.      fail to recognize as such. (I have personally experienced this problem
  671.      with a Cyrix 83D87-33 that I tried to push to 40 MHz. It passed all the
  672.      diagnostic benchmarks on the Cyrix diagnostic disk and the tests of some
  673.      commercial system test programs. However, I found it to fail the
  674.      Whetstone and Linpack benchmarks, which include accuracy checks.)
  675.      Although there is usually no problem with overheating when pushing a
  676.      coprocessor over the specified maximum frequency rating, be warned that
  677.      operation of a coprocessor above the maximum ratings stated by the
  678.      manufacturer may make its operation unreliable.
  679.  
  680.      Some 386 boards allow the coprocessor to be clocked differently than the
  681.      CPU. This is called "asynchronous operation" and allows you, for
  682.      example, to run the coprocessor at 33 MHz while the CPU runs at 40 MHz.
  683.      Of the currently available math coprocessors, only the Intel 80387 and
  684.      387DX support asynchronous operation. The 387-compatible "clones" from
  685.      Cyrix, C&T, IIT and ULSI always run at the full speed of the CPU, even
  686.      if you have set up your motherboard for asynchronous operation.
  687.  
  688. 3)   Once you've got the correct coprocessor for your system you can start
  689.      the actual installation process. Turn off the computer's power switch
  690.      and unplug the power cord from the wall outlet, remove the case, and
  691.      locate the math coprocessor socket. This socket is always located right
  692.      next to the main CPU, which can be identified by the printing on top of
  693.      the chip. (It's also usually one of the biggest chips on the board). The
  694.      8078 and 80287 DIL sockets are rectangular sockets with 20 pin holes on
  695.      each of the longer sides. The 387SX PLCC socket is a square socket that
  696.      has 17 vertical connector strips on the 'wall' of each side. The 387 PGA
  697.      socket is square and has two rows of pin holes on each side. The EMC
  698.      socket for the Weitek 3167 is similar but has three rows of holes on
  699.      each side. The PGA socket for the Weitek 4167 is also square with three
  700.      rows of holes on each side. If you can't find the math coprocessor
  701.      socket, consult your owner's manual, your computer dealer, or a
  702.      knowledgeable friend.
  703.  
  704.      If you are installing the Intel RapidCAD chipset in a 386 system, you
  705.      will have to remove the 386 CPU first. Intel provides an easy-to-use
  706.      chip extractor and a storage box for the 386 chip for this purpose. Just
  707.      follow the instructions in the RapidCAD installation manual.
  708.  
  709.      On many systems, the motherboard is supported only at a small number of
  710.      points. Since considerable force is required to insert a pin grid chip
  711.      like the 80387, RapidCAD, or Weitek Abacus 3167 into its socket, the
  712.      board may bend quite a lot due to the insertion pressure. This could
  713.      cause cracks in the board's conductive traces that may render it
  714.      intermittently or completely inoperable. Damage done to the board in
  715.      this way is usually not covered by the computer's warranty! Therefore,
  716.      it may be a good idea to first check how much the board bends by
  717.      pressing on the math coprocessor socket with your finger. If you find it
  718.      to bend easily, try to put something under the board directly beneath
  719.      the coprocessor socket. If this is impossible, as it is in many desktop
  720.      cases, consider removing the whole mother board from the case, and
  721.      placing it on a hard, flat surface free of static electricity. (You will
  722.      also have to do this if your system's CPU and coprocessor socket are on
  723.      a separate card rather than on the motherboard, as is typical in many
  724.      modular systems.)
  725.  
  726.      Be sure you are properly grounded before you remove the coprocessor from
  727.      its antistatic box, as even a tiny jolt of static electricity can ruin
  728.      the coprocessor. Make sure you do not touch the pins on the bottom of
  729.      the chip.
  730.  
  731.      Check the pins and make sure none are bent; if some are, you can
  732.      *carefully* straighten them with needle-nose pliers or tweezers.
  733.  
  734. 4)   Match the coprocessor's orientation with the orientation of the socket.
  735.      Correct orientation of the coprocessor is absolutely essential, because
  736.      if you insert it the wrong way it may be damaged.
  737.  
  738.      8087 and 287 coprocessors have a notch on one the shorter sides of their
  739.      rectangular DIL package that should be matched with the notch of the
  740.      coprocessor socket. Usually the 286 CPU and the 287 coprocessor are
  741.      placed alongside each other and both have the same orientation, (that
  742.      is, their respective notches point in the same direction). 387SX
  743.      coprocessors feature a white dot or similar mark that matches with some
  744.      sort of marking on the socket. 387 coprocessors have a bevelled corner
  745.      that is also marked with a white dot or similar marking. This should be
  746.      matched with the bevelled or otherwise marked corner of the socket. If
  747.      your system has only a large EMC socket and you are installing a 387 in
  748.      it, you will leave one row of pin holes free on each side of the chip.
  749.  
  750.      Once you have found the correct orientation, place the chip over the
  751.      socket and make sure all pins are correctly aligned with their
  752.      respective holes. Press firmly and evenly on the chip -- you may have to
  753.      press hard to seat the coprocessor all the way. Again, make sure your
  754.      motherboard does not bend more than slightly under the insertion
  755.      pressure. For 8087, 287, and 387 coprocessors it is normal that the
  756.      coprocessor does not go all the way in; about one millimeter (1/25 inch)
  757.      of space is usually left between the socket and the bottom of the
  758.      coprocessor chip. (This allows the insertion of a extraction device
  759.      should it become necessary to remove the chip. Note that the
  760.      construction of the 387SX's PLCC socket makes it next-to-impossible to
  761.      remove the coprocessor once fully inserted, as the top of the chip is
  762.      level with the socket's 'walls'.)
  763.  
  764. 5)   Check your computer's manual for the proper position of any jumpers or
  765.      switches that need to be set to tell the system it now has a coprocessor
  766.      (and possibly, which kind it has). Put the cover back on the system
  767.      unit, reconnect the power, and turn on your computer. Depending on your
  768.      system's BIOS, you may now have to run a setup or configuration program
  769.      to enable the coprocessor. Finally, run the programs supplied on the
  770.      diagnostic disk (included with your coprocessor) to check for its
  771.      correct operation.
  772.  
  773.  
  774.  
  775. =================================================================
  776. Descriptions of available coprocessors, CPU+FPU (as of 01-11-93):
  777. =================================================================
  778.  
  779. Intel 8087
  780.  
  781.      [43] This was the first coprocessor that Intel made available for the
  782.      80x86 family. It was introduced in 1980 and therefore does not have full
  783.      compatibility with the IEEE-754 standard for floating-point arithmetic,
  784.      (which was finally released in 1985). It complements the 8088 and 8086
  785.      CPUs and can also be interfaced to the 80188 and 80186 processors.
  786.  
  787.      The 8087 is implemented using NMOS. It comes in a 40-pin CERDIP (ceramic
  788.      dual inline package). It is available in 5 MHz, 8 MHz (8087-2), and 10
  789.      MHz (8087-1) versions. Power consumption is rated at max. 2400 mW [42].
  790.  
  791.      A neat trick to enhance the processing power of the 8087 for
  792.      computations that use only the basic arithmetic operations (+,-,*,/) and
  793.      do not require high precision is to set the precision control to single-
  794.      precision. This gives one a performance increase of up to 20%. For
  795.      details about programming the precision control, see program PCtrl in
  796.      appendix A.
  797.  
  798.      With the help of an additional chip, the 8087 can in theory be
  799.      interfaced to an 80186 CPU [36]. The 80186 was used in some PCs (e.g.
  800.      from Philips, Siemens) in the 1982/1983 time frame, but with IBM's
  801.      introduction of the 80286-based AT in 1984, it soon lost all
  802.      significance for the PC market.
  803.  
  804.  
  805. Intel 80187
  806.  
  807.      The 80187 is a rather new coprocessor designed to support the 80C186
  808.      embedded controller (a CMOS version of the 80186 CPU; see above). It was
  809.      introduced in 1989 and implements the complete 80387 instruction set. It
  810.      is available in a 40 pin CERDIP (ceramic dual inline package) and a 44
  811.      pin PLCC (plastic leaded chip carrier) for 12.5 and 16 MHz operation.
  812.      Power consumption is rated at max. 675 mW for the 12.5 MHz version and
  813.      max. 780 mW for the 16 MHz version [37].
  814.  
  815.  
  816. Intel 80287
  817.  
  818.      [44] This is the original Intel coprocessor for the 80286, introduced in
  819.      1983. It uses the same internal execution unit as the 8087 and therefore
  820.      has the same speed (actually, it is sometimes slower due to additional
  821.      overhead in CPU-coprocessor communication). As with the 8087, it does
  822.      not provide full compatibility with the IEEE-754 floating point standard
  823.      released in 1985.
  824.  
  825.      The 80287 was manufactured in NMOS technology, and is packaged in a 40-
  826.      pin CERDIP (ceramic dual inline package). There are 6 MHz, 8 MHz, and 10
  827.      MHz versions. Power consumption can be estimated to be the same as that
  828.      for the 8087, which is 2400 mW max.
  829.  
  830.      The 80287 has been replaced in the Intel 80x87 family with its faster
  831.      successor, the CMOS-based Intel 287XL, which was introduced in 1990 (see
  832.      below). There may still be a few of the old 80287 chips on the market,
  833.      however.
  834.  
  835.  
  836. Intel 80287XL
  837.  
  838.      This chip is Intel's second-generation 287, first introduced in 1990.
  839.      Since it is based on the 80387 coprocessor core, it features full IEEE
  840.      754 compatibility and faster instruction execution. Intel claims about
  841.      50% faster operation than the 80287 for typical benchmark tests such as
  842.      Whetstone [45]. Comparison with benchmark results for the AMD 80C287,
  843.      which is identical to the Intel 80287, support this claim [1]: The Intel
  844.      287XL performed 66% faster than the AMD 80C287 on a fractal benchmark
  845.      and 66% faster on the Whetstone benchmark in these tests. Whetstone
  846.      results from [46] show the Intel 287XL at 12.5 MHz to perform 552
  847.      kWhets/sec as opposed to the AMD's 80C287 289 kWhets/sec, a 91%
  848.      performance increase. A benchmark using the MathPak program showed the
  849.      Intel 287XL to be 59% faster than the Intel 80287 (6.9 sec. vs. 11.0
  850.      sec.) [26]. Since the 287XL has all the additional instructions and
  851.      enhancements of a 387, most software automatically identifies it as an
  852.      80387-compatible coprocessor and therefore can make use of extra 387-
  853.      only features, such as the FSIN and FCOS instructions.
  854.  
  855.      The 287XL is manufactured in CMOS and therefore uses much less power
  856.      than the older NMOS-based 80287. At 12.5 MHz, the power consumption is
  857.      rated at max. 675 mW, about 1/4 of the 80287 power consumption. The
  858.      287XL is available in either a 40-pin CERDIP (ceramic dual inline
  859.      package) or a 44 pin PLCC (plastic leaded chip carrier). (This latter
  860.      version is called the 287XLT and intended mainly for laptop use.) The
  861.      287XL is rated for speeds of up to 12.5 MHz.
  862.  
  863.  
  864. AMD 80C287
  865.  
  866.      This chip, manufactured by Advanced Micro Devices (AMD), is an exact
  867.      clone of the old Intel 80287, and was first brought to market by AMD in
  868.      1989. It contains the original microcode of the 80287 and is therefore
  869.      100% compatible with it. However, as the name indicates, the 80C287 is
  870.      manufactured in CMOS and therefore uses less power than an equivalent
  871.      Intel 80287. At 12.5 MHz, its power consumption is rated at max. 625 mW
  872.      or slightly less than that of the Intel 80287XL [27]. There is also
  873.      another version called AMD 80EC287 that uses an 'intelligent' power save
  874.      feature to reduce the power consumption below 80C287 levels. Tests at
  875.      10.7 MHz show typical power consumption for the 80EC287 to be at 30 mW,
  876.      compared to 150 mW for the AMD 80C287, 300 mW for the Intel 287XL and
  877.      1500 mW for the Intel 80287 [57]. The 80EC287 is therefore ideally
  878.      suited for low power laptop systems.
  879.  
  880.      The AMD 80C287 is available in speeds of 10, 12, and 16 MHz. (I have
  881.      only seen it being offered in 10 MHz and 12 MHz versions, however.) At
  882.      about US$ 50, it is currently the cheapest coprocessor available. Note
  883.      that it provides less performance than the newer Intel 287XL (see
  884.      above). The AMD 80C287 is available in 40 pin ceramic and plastic DIPs
  885.      (dual inline package) and as 44 pin PLCC (plastic leaded chip carrier).
  886.  
  887.      Due to recent legal battles with Intel over the right to use the 287
  888.      microcode, which AMD lost, AMD may have to discontinue this product
  889.      (disclaimer: I am not a legal expert).
  890.  
  891.  
  892. Cyrix 82S87
  893.  
  894.      This 80287-compatible chip was developed from the Cyrix 83D87, (Cyrix's
  895.      80387 'clone') and has been available since 1991. It complies completely
  896.      with the IEEE-754 standard for floating-point arithmetic and features
  897.      nearly total compatibility with Intel's coprocessors, including
  898.      implementation of the full Intel 80387 instruction set. It implements
  899.      the transcendental functions with the same degree of accuracy and the
  900.      superior speed of the Cyrix 83D87. This makes the Cyrix 82S87 the
  901.      fastest [1] and most accurate 287 compatible coprocessor available.
  902.      Documentation by Cyrix [46] rates the 82S87 at 730 kWhets/sec for a 12.5
  903.      MHz system, while the Intel 287XL performs only 552 kWhets/sec. 82S87
  904.      chips manufactured after 1991 use the internals of the Cyrix 387+, which
  905.      succeeds the original 83D87 [73].
  906.  
  907.      The 82S87 is a fully static CMOS design with very low power requirements
  908.      that can run at speeds of 6 to 20 MHz. Cyrix documentation shows the
  909.      82S87 to consume about the same amount of power as the AMD 80C287 (see
  910.      above). The 82S87 comes in a 40 pin DIP or a 44 pin PLCC (plastic leaded
  911.      chip carrier) compatible with the pinout of the Intel 287XLT and
  912.      ideally suited for laptop use.
  913.  
  914.  
  915. IIT 2C87
  916.  
  917.      This chip was the first 80287 clone available, introduced to the market
  918.      in 1989. It has about the same speed as the Intel 287XL [1]. The 2C87
  919.      implements the full 80387 instruction set [38]. Tests I ran on the 3C87
  920.      seem to indicate that it is not fully compatible with the IEEE-754
  921.      standard for floating-point arithmetic (see below for details), so it
  922.      can be assumed that the 2C87 also fails these test (as it presumably
  923.      uses the same core as the 3C87).
  924.  
  925.      The IIT 2C87 provides extra functions not available on any other 287
  926.      chip [38]. It has 24 user-accessible floating-point registers organized
  927.      into three register banks. Additional instructions (FSBP0, FSBP1, FSBP2)
  928.      allow switching from one bank to another. (Transfers between registers
  929.      in different banks are not supported, however, so this feature by itself
  930.      is of limited usefulness. Also, there seems to be only one status
  931.      register (containing the stack top pointer), so it has to be manually
  932.      loaded and stored when switching between banks with a different number
  933.      of registers in use [40]). The register bank's main purpose is to aid
  934.      the fourth additional instruction the 2C87 has (F4X4), which does a full
  935.      multiply of a 4x4 matrix by a 4x1 vector, an operation common in 3D-
  936.      graphics applications [39]. The built-in matrix multiply speeds this
  937.      operation up by a factor of 6 to 8 when compared to a programmed
  938.      solution according to the manufacturer [38]. Tests show the speed-up to
  939.      be indeed in this range [40]. For the 3C87, I measured the execution
  940.      time of F4X4 to be about 280 clock cycles; the execution time on the
  941.      2C87 should be somewhat larger - I estimate it to be around 310 clock
  942.      cycles due to the higher CPU-NDP communication overhead in instruction
  943.      execution in 286/287 systems (~45-50 clock cycles) compared with 386/387
  944.      systems (~16-20 clock cycles). As desirable as the F4X4 instruction may
  945.      seem, however, there are very few applications that make use of it when
  946.      an IIT coprocessor is detected at run time (among them Schroff
  947.      Development's Silver Screen and Evolution Computing's Fast-CAD 3-D
  948.      [25]).
  949.  
  950.      The 2C87 is available for speeds of up to 20 MHz. It is implemented in
  951.      an advanced CMOS process and has therefore a low power consumption of
  952.      typically about 500 mW [38].
  953.  
  954.  
  955. Intel 80387
  956.  
  957.      This chip was the first generation of coprocessors designed specifically
  958.      for the Intel 80386 CPU. It was introduced in 1986, about one year after
  959.      the 80386 was brought to market. Early 386 system were therefore
  960.      equipped with both a 80287 and a 80387 socket. The 80386 does work with
  961.      an 80287, but the numerical performance is hardly adequate for such a
  962.      system.
  963.  
  964.      The 80387 has itself since been superseded by the Intel 387DX introduced
  965.      by a quiet change in 1989 (see below). You might find it when acquiring
  966.      an older 386 machine, though. The old 80387 is about 20% slower than the
  967.      newer 387DX.
  968.  
  969.      The 80387 is packaged in a 68-pin ceramic PGA, and was manufactured
  970.      using Intel's older 1.5 micron CHMOS III technology, giving it moderate
  971.      power requirements. Power consumption at 16 MHz is max. 1250 mW (750 mW
  972.      typical), at 20 MHz max. 1550 mW (950 mW typical), and at 25 MHz max.
  973.      1950 mW (1250 mW typical) [60].
  974.  
  975.  
  976. Intel 387DX
  977.  
  978.      The 387DX is the second-generation Intel 387; it was quietly introduced
  979.      to replace the original 80387 in 1989. This version is done in a more
  980.      advanced CMOS process which enables the coprocessor to run at a maximum
  981.      frequency of 33 MHz (the 80387 was limited to a maximum frequency of 25
  982.      MHz). The 387DX is also about 20% faster than the 80387 on the average
  983.      for the same clock frequency. For a 386/387 system operating at 29 MHz
  984.      the Whetstone benchmark (compiled with the highly optimizing Metaware
  985.      High-C V1.6) runs at 2377 kWhetstones/sec for the 80387 and at 2693
  986.      kWhetstones/sec for the 387DX, a 13% increase. In a fractal calculation
  987.      programmed in assembly language, the 387DX performance was 28% higher
  988.      than the performance of the 80387. The transcendental functions have
  989.      also sped up from the 80387 to the 387DX. In the Savage benchmark
  990.      (again, compiled with Metaware High-C V1.6 and running on a 29 MHz
  991.      system), the 80387 evaluated 77600 function calls/second, while the
  992.      387DX evaluated 97800 function calls/second, a 26% increase [7]. Some
  993.      instructions have been sped up a lot more than the average 20%. For
  994.      example, the performance of the FBSTP instruction has increased by a
  995.      factor of 3.64.
  996.  
  997.      The Intel 387DX (and its predecessor 80387) are the only 387
  998.      coprocessors that support asynchronous operation of CPU and coprocessor.
  999.      The 387 consists of a bus interface unit and a numerical execution unit.
  1000.      The bus interface unit always runs at the speed of the CPU clock
  1001.      (CPUCLK2). If the CKM (ClocK Mode) pin of the 387 is strapped to Vcc,
  1002.      the numerical execution unit runs at the same speed as the bus interface
  1003.      unit. If CKM is tied to ground, the numerical execution unit runs at the
  1004.      speed provided by the NUMCLK2 input. The ratio of NUMCLK2 (coprocessor
  1005.      clock) to CPUCLK2 (CPU clock) must lie within the range 10:16 to 14:10.
  1006.      For example, for a 20 MHz 386, the Intel 387DX could be clocked from
  1007.      12.5 MHz to 28 MHz via the NUMCLK2 input. (On the Cyrix 83D87, Cyrix
  1008.      387+, ULSI 83C87, and the IIT 387, the CKM pin is not connected. These
  1009.      coprocessors are therefore not capable of asynchronous operation and
  1010.      always run at the speed of the CPU.)
  1011.  
  1012.      The Intel 387DX is manufactured using Intel's advanced low power CHMOS
  1013.      IV technology. Power consumption at 20 MHz is max. 900 mW (525 mW
  1014.      typical), at 25 MHz max. 1050 mW (625 mW typical), and at 33 MHz max.
  1015.      1250 mW (750 mW typical) [59].
  1016.  
  1017.  
  1018. Intel 387SX
  1019.  
  1020.      This is the coprocessor paired with the Intel 386SX CPU. The 386SX is an
  1021.      Intel 80386 with a 16-bit, rather than 32-bit, data path. This reduces
  1022.      (somewhat) the costs to build a 386SX system as compared to a full 32-
  1023.      bit design required by a 386DX. (The 386SX's main *marketing* purpose
  1024.      was to replace the 80286 CPU, which was being sold more cheaply by other
  1025.      manufacturers [such as AMD], and which Intel subsequently stopped
  1026.      producing.) Due to the 16-bit data path, the 386SX is slower than the
  1027.      386DX and offers about the same speed as an 80286 at the same clock
  1028.      frequency for 16-bit applications. But as the 386SX is a complete 80386
  1029.      internally, it offers also the possibility to run 32-bit applications
  1030.      and supports the virtual 8086 mode (used for example by Windows' 386
  1031.      enhanced mode).
  1032.  
  1033.      The 387SX has all the features of the Intel 80387, including the ability
  1034.      of asynchronous operation of CPU and coprocessor (see Intel 387DX
  1035.      information, above). Due to the 16 bit data path between the CPU and the
  1036.      coprocessor, the 387SX is a bit slower than a 80387 operating at the
  1037.      same frequency. In addition, the 387SX is based on the core of the
  1038.      original 80387, which executes instructions slower than the second
  1039.      generation 387DX.
  1040.  
  1041.      The 387SX comes in a 68-pin PLCC (plastic leaded chip carrier) package
  1042.      and is available in 16 MHz and 20 MHz versions. (Coprocessors for faster
  1043.      386SX systems based on the Am386SX CPU are available from IIT, Cyrix,
  1044.      and ULSI.) Power consumption for the 387SX at 16 MHz is max. 1250 mW
  1045.      (740 mW typical); for the 20 MHz version it is max. 1500 mW (1000 mW
  1046.      typical) [62].
  1047.  
  1048.  
  1049. Intel 387SL
  1050.  
  1051.      This coprocessor is designed for use in systems that contain an Intel
  1052.      386SL as the CPU. The 386SL is directly derived from the 386SX. It is a
  1053.      static CHMOS IV design with very low power requirements that is intended
  1054.      to be used in notebook and laptop computers. It features an integrated
  1055.      cache controller, a programmable memory controller, and hardware support
  1056.      for expanded memory according to the LIM EMS 4.0 standard. The 387SL,
  1057.      introduced in early 1992, has been designed to accompany the 386SL in
  1058.      machines with low power consumption and substitute the 387SX for this
  1059.      purpose. It features advanced power saving mechanisms. It is based on
  1060.      the 387DX core, rather than on the older and slower 80387 core (which is
  1061.      used by the 387SX).
  1062.  
  1063.  
  1064. IIT 3C87
  1065.  
  1066.      This IIT chip was introduced in 1989, about the same time as the Cyrix
  1067.      83D87. Both coprocessors are faster than Intel's 387DX coprocessor. The
  1068.      IIT 3C87 also provides extra functions not available on any other 387
  1069.      chip [38]. It has 24 user-accessible floating-point registers organized
  1070.      into three register banks. Three additional instructions (FSBP0, FSBP1,
  1071.      FSBP2) allow switching from one bank to another. (Transfers between
  1072.      registers in different banks are not supported, however, so this feature
  1073.      by itself is of limited usefulness. Also, there seems to be only one
  1074.      status register [containing the stack top pointer], so it has to be
  1075.      manually loaded and stored when switching between banks with a different
  1076.      number of registers in use [40]). The register bank's main purpose is to
  1077.      aid the fourth additional instruction the 3C87 has (F4X4), which does a
  1078.      full multiply of a 4x4 matrix by a 4x1 vector, an operation common in
  1079.      3D-graphics applications [39]. The built-in matrix multiply speeds this
  1080.      operation up by a factor of 6 to 8 when compared to a programmed
  1081.      solution according to the manufacturer [38]. Tests show the speed-up to
  1082.      be indeed in this range [40]. I measured the F4X4 to execute in about
  1083.      280 clock cycles, during which time it executes 16 multiplications and
  1084.      12 additions. The built-in matrix multiply speeds up the matrix-by-
  1085.      vector multiply by a factor of 3 compared with a programmed solution
  1086.      according to IIT [39]. The results for my own TRNSFORM benchmark support
  1087.      this claim (see results below), showing a performance increase by a
  1088.      factor of about 2.5. This makes matrix multiplies on the IIT 3C87 nearly
  1089.      as fast as on an Intel 486 at the same clock frequency. As desirable as
  1090.      the F4X4 instruction may seem, however, there are very few applications
  1091.      that make use of it when an IIT coprocessor is detected at run time
  1092.      (among them Schroff Development's Silver Screen and Evolution
  1093.      Computing's Fast-CAD 3-D [25]).
  1094.  
  1095.      These IIT-specific instructions also work correctly when using a Chips &
  1096.      Technologies 38600DX or a Cyrix 486DLC CPU, which are both marketed as
  1097.      faster replacements for the Intel 386DX CPU.
  1098.  
  1099.      Tests I ran with the IEEETEST program show that the 3C87 is not fully
  1100.      compatible with the IEEE-754 standard for floating-point arithmetic,
  1101.      although the manufacturer claims otherwise. It is indeed possible that
  1102.      the reported errors are due to personal interpretations of the standard
  1103.      by the program's author that have been incorporated into IEEETEST and
  1104.      that the standard also supports the different interpretation chosen by
  1105.      IIT. On the other hand, the IEEE test vectors incorporated into IEEETEST
  1106.      have become somewhat of an industry standard [66] and Intel's 387, 486,
  1107.      and RapidCAD chips pass the test without a single failure, so the fact
  1108.      that the IIT 3C87 fails some of the tests indicates that it is not fully
  1109.      compatible with the Intel 387 coprocessor. My tests also show that the
  1110.      IIT 3C87 does not support denormals for the double extended format. It
  1111.      is not entirely clear whether the IEEE standard mandates support for
  1112.      extended precision denormals, as the IEEE-754 document explicitly only
  1113.      mentions single and double-precision denormals. Missing support for
  1114.      denormals is not a critical issue for most applications, but there are
  1115.      some programs for which support of denormals is at the very least quite
  1116.      helpful [41]. In any case, failure of the 3C87 to support extended
  1117.      precision denormal numbers does represent an incompatibility with the
  1118.      Intel 387 and 486 chips.
  1119.  
  1120.      The 3C87 is implemented in an advanced CMOS process and has low power
  1121.      requirements, typically about 600 mW. Like the 387 'clones' from Cyrix
  1122.      and ULSI, the 3C87 does not support asynchronous operation of the CPU
  1123.      and the coprocessor, but always runs at the full speed of the CPU. It is
  1124.      available in 16, 20, 25, 33, and 40 MHz versions.
  1125.  
  1126.  
  1127. IIT 3C87SX
  1128.  
  1129.      This is the version of the IIT 3C87 that is intended for use with
  1130.      Intel's 386SX or AMD's Am386SX CPU, and is functionally equivalent to
  1131.      the IIT3C87. Due to the 16-bit data path between the CPU and the
  1132.      coprocessor in a 386SX- based system, coprocessor instructions will
  1133.      execute somewhat more slowly than on the 3C87. At present, the IIT
  1134.      3C87SX is the only 387SX coprocessor that is offered at speeds of 16,
  1135.      20, 25, and 33 MHz. (I have read that Cyrix has also announced an 83S87-
  1136.      33, but haven't seen it being offered yet.) The 3C87SX is packaged in a
  1137.      68-pin PLCC.
  1138.  
  1139.  
  1140. Cyrix FasMath 83D87
  1141.  
  1142.      This chip was introduced in 1989, only shortly after the coprocessors
  1143.      from IIT. It has been found to be the fastest 387-compatible coprocessor
  1144.      in several benchmark comparisons [1,7,68,69]. It also came out as the
  1145.      fastest coprocessor in my own tests (see benchmark results below).
  1146.      Although the Cyrix 83D87 provides up to 50% more performance than the
  1147.      Intel 387DX in benchmarks comparisons, the speed advantage over other
  1148.      387-compatible coprocessors in real applications is usually much
  1149.      smaller, because coprocessor instructions represent only a small part of
  1150.      the total application code. For example, in a test using the program 3D-
  1151.      Studio, the Cyrix 83D87 was 6% faster than the Intel 387DX [1].
  1152.  
  1153.      Besides being the fastest 387 coprocessor, the 83D87 also offers the
  1154.      most accurate transcendental functions results of all coprocessors
  1155.      tested (see test results below). The new "387+" version of the 83D87,
  1156.      available since November 1991, even surpasses the level of accuracy of
  1157.      the original 83D87 design. Note that the name 387+ is used in European
  1158.      distribution only. In other parts of the world, the new chip still goes
  1159.      by the name 83D87.
  1160.  
  1161.      Unlike Intel's coprocessors, which use the CORDIC [18,19] algorithm to
  1162.      compute the transcendental functions, Cyrix uses polynomial and rational
  1163.      approximations to the functions. In the past the CORDIC method has been
  1164.      popular since it requires only shifts and adds, which made it relatively
  1165.      easy to implement a reasonably fast algorithm. Recently, the cost for the
  1166.      implementation of fast floating-point hardware multipliers has dropped
  1167.      significantly (due to the availability of VLSI), making the use of
  1168.      polynomial and rational approximations superior to CORDIC for the
  1169.      generation of transcendental functions [61]. The Cyrix 83D87 uses a fast
  1170.      array multiplier, making its transcendental functions faster than those
  1171.      of any other 387 compatible coprocessor. It also uses 75 bit for the
  1172.      mantissa in intermediate calculations (as opposed to 68 bits on other
  1173.      coprocessors), making its transcendental functions more accurate than
  1174.      those of any other coprocessor or FPU (see results below).
  1175.  
  1176.      The 83D87 (and its successor, the 387+) are the 387 'clones' with the
  1177.      highest degree of compatibility to the Intel 387DX. A few minor software
  1178.      and hardware incompatibilities have been documented by Cyrix [12]. The
  1179.      software differences are caused by some bugs present in the 387DX that
  1180.      Cyrix fixed in the 83D87. Unlike the Intel 387DX, the 83D87 (and all
  1181.      other 387-compatible chips as well) does not support asynchronous
  1182.      operation of CPU and coprocessor. There were also problems in the past
  1183.      with the CPU-coprocessor communications, causing the 83D87 to
  1184.      occasionally hang on some machines. The reason behind this was that
  1185.      Cyrix shaved off a wait state in the communication protocol, which
  1186.      caused a communications breakdown between the CPU and the 83D87 for some
  1187.      systems running at 25 MHz or faster. (One notable example of this
  1188.      behavior was the Intel 302 board.) Also there were problems with boards
  1189.      based on early revisions of the OPTI chipset. These problem are only
  1190.      rarely encountered with the current generation of 386 motherboards, and
  1191.      it is possible that it has been entirely eliminated in the 387+, the
  1192.      successor to the 83D87.
  1193.  
  1194.      To reduce power consumption the 83D87 features advanced power saving
  1195.      features. Those portions of the coprocessor that are not needed are
  1196.      automatically shut down. If no coprocessor instructions are being
  1197.      executed, *all* parts except the bus interface unit are shut down [12].
  1198.      Maximal power consumption of the Cyrix 83D87 at 33 MHz is 1900 mW, while
  1199.      typical power consumption at this clock frequency is 500 mW [15].
  1200.  
  1201.  
  1202. Cyrix EMC87
  1203.  
  1204.      This coprocessor is basically a special version of the Cyrix 83D87,
  1205.      introduced in 1990. In addition to the normal 387 operating mode, in
  1206.      which coprocessor-CPU communication is handled through reserved IO
  1207.      ports, it also offers a memory-mapped mode of operation similar to the
  1208.      operation principle of the Weitek Abacus. Like the Weitek chip, the
  1209.      EMC87 occupies a block of memory starting at physical address C0000000h
  1210.      (the Abacus occupies a memory block of 64 KB, while the EMC87 uses only
  1211.      4 KB [77]). It can therefore only be accessed in the protected or
  1212.      virtual modes of the 386 CPU. DOS programs can access the EMC87 with the
  1213.      help of DOS extenders or memory managers like EMM386 which run in
  1214.      protected/virtual mode themselves. To implement the memory-mapped
  1215.      interface, the usual 80x87 architecture has been slightly expanded with
  1216.      three additional registers and eleven additional instructions that can
  1217.      only be used if the memory-mapped mode is enabled.
  1218.  
  1219.      Using this special mode of the EMC87 provides a significant speed
  1220.      advantage. The traditional 387 CPU-coprocessor interface via IO ports
  1221.      has an overhead of about 14-20 clock cycles. Since the Cyrix 83D87
  1222.      executes some operations like addition and multiplication in much less
  1223.      time, its performance is actually limited by the CPU-coprocessor
  1224.      interface. Since the memory-mapped mode has much less overhead, it
  1225.      allows all coprocessor instructions to be executed at full speed with no
  1226.      penalty.
  1227.  
  1228.      Originally, Cyrix claimed support for the fast memory-mapped mode of the
  1229.      EMC87 from a number of software vendors (including Borland and
  1230.      Microsoft). However, there are only very few applications that make use
  1231.      of it, among them Evolution Computing's FastCAD 3D, MicroWay Inc.'s NDP
  1232.      FORTRAN-386 compiler, Metaware's High-C compiler version 1.6 and newer,
  1233.      and Intusofts's Spice [63,73]. Part of the problem in supporting the
  1234.      memory-mapped mode is that the application must reserve one of the
  1235.      general purpose registers of the CPU to use memory-mapped mode
  1236.      instructions that access memory.
  1237.  
  1238.      (Note that the EMC87 is *not* compatible with Weitek's Abacus
  1239.      coprocessor. They both use the same CPU interface technique [memory
  1240.      mapping], but while the EMC87 uses the standard 387 instruction set, the
  1241.      Weitek Abacus coprocessors use a different instruction set entirely its
  1242.      own.)
  1243.  
  1244.      Since the EMC87 provides also the standard 386/387 CPU interface via IO
  1245.      ports, it can be used just like any other 387-compatible coprocessor and
  1246.      delivers the same performance as the Cyrix 83D87 in this mode. The EMC87
  1247.      even allows mixed use of memory-mapped and traditional instructions in
  1248.      the same code. Cyrix has also implemented some additional instructions
  1249.      in the EMC87 that are also available in the 387-compatible mode:
  1250.      FRICHOP, FRINT2, and FRINEAR. These instructions enable rounding to
  1251.      integer without setting the rounding mode by manipulating the
  1252.      coprocessor control word, and are intended to make life easier for
  1253.      compiler writers.
  1254.  
  1255.      In a test, the EMC87 at 33 MHz ran the single-precision Whetstone
  1256.      benchmark at 7608 kWhetstones/sec, while the Cyrix 83D87 at 33 MHz had a
  1257.      speed of only 5049 kWhetstones/sec, an increase of 50.6% [63]. In
  1258.      another test, the EMC87 ran a fractal computation at twice the speed of
  1259.      the Cyrix 83D87 and 2.6 times as fast as an Intel 387DX [64]. A third
  1260.      test found the EMC87's overall performance to be 20% higher than the
  1261.      performance of the Cyrix 83D87 [65].
  1262.  
  1263.      The Cyrix FasMath EMC87 has also been marketed as Cyrix AutoMATH; the
  1264.      two chips are identical. Unlike the Cyrix 83D87, which fits into the 68-
  1265.      pin 387 coprocessor socket, the EMC87 comes in a 121-pin PGA and
  1266.      requires the 121-pin EMC (Extended Math Coprocessor) socket. Note that
  1267.      not all boards have such a socket (a notable exception being IBM's
  1268.      PS/2s, for example). The EMC87 is available 25 and 33 MHz versions.
  1269.      Maximum power consumption at 33 MHz is 2000 mW.
  1270.  
  1271.      Cyrix appears currently to be phasing out the EMC87.
  1272.  
  1273.  
  1274. Cyrix FasMath 387+
  1275.  
  1276.      This chip is the second-generation successor to the Cyrix 83D87. (The
  1277.      name "387+" is only used for European distribution; in other parts of
  1278.      the world, it goes by the original 83D87 designation.) According to a
  1279.      source within Cyrix [73], the 387+ was designed to make a smaller (and
  1280.      thus cheaper to manufacture) coprocessor chip that could also be pushed
  1281.      to higher frequencies than the original chip: the 387+ is available in
  1282.      versions of up to 40 MHz, whereas the original 83D87 could go no faster
  1283.      than 33 MHz.
  1284.  
  1285.      The Cyrix 387+ is ideally suited to be used with Cyrix's 486DLC CPU,
  1286.      which is a 486SX compatible replacement chips for the Intel 386DX.
  1287.      Indeed Cyrix sells upgrade kits consisting of a 486DLC CPU and a
  1288.      Cyrix 387+.
  1289.  
  1290.      In my tests, I found the Cyrix 387+ to be about five to 10 percent
  1291.      *slower* than the Cyrix 83D87. However, some instructions like the
  1292.      square root (FSQRT) now run at only half the speed at which they ran in
  1293.      the 83D87, and most transcendental functions show about a 40% drop in
  1294.      performance compared to their 83D87 averages (see performance results,
  1295.      below). However, I did find the transcendental functions on the 387+ to
  1296.      be a bit *more* accurate than those implemented in the 83D87. The new
  1297.      design uses a slower hardware multiplier that needs six clock cycles to
  1298.      multiply the floating-point mantissa of an internal precision number,
  1299.      while the multiplier in the 83D87 takes only 4 clocks to accomplish the
  1300.      same task. Since the transcendental functions in Cyrix math coprocessors
  1301.      are generated by polynomial and rational approximations, this slows them
  1302.      down significantly.
  1303.  
  1304.      The divide/square root logic has also been changed from the 83D87
  1305.      design. The original design used an algorithm that could generate both
  1306.      the quotient and square root, so the execution times for these
  1307.      instructions were nearly identical. The algorithm chosen for the
  1308.      division in the 387+ doesn't allow the square root to be taken so
  1309.      easily, so it takes nearly twice as long.
  1310.  
  1311.      In the 387+, the available argument range for the FYL2XP1 instruction
  1312.      has been extended, from the usual range -1+sqrt(2)/2..sqrt(2)/2 that is
  1313.      found on all 80x87 coprocessors, to include all floating-point numbers.
  1314.      Also, four additional instructions have been implemented: FRICHOP
  1315.      (opcode DD FC), FRINT2 (opcode DB FC), FRINEAR (opcode DF FC), and FTSTP
  1316.      (opcode D9 E6).
  1317.  
  1318.  
  1319. Cyrix FasMath 83S87
  1320.  
  1321.      The 83S87 is the SX version of the Cyrix 83D87. Just as the 83D87 is the
  1322.      fastest 387-compatible coprocessor, the Cyrix 83S87 is the fastest of
  1323.      the 387SX compatible coprocessors [1], as well as providing the most
  1324.      accurate transcendental functions. 83S87 chips manufactured after 1991
  1325.      use the internals of the Cyrix 387+, the successor to the original 83D87
  1326.      [73] (above). The Cyrix 83S87 is ideally suited to be used with the
  1327.      Cyrix Cx486SLC CPU, a 486SX compatible CPU which is a replacement chip
  1328.      for the Intel 386SX CPU.
  1329.  
  1330.      The 83S87 is packaged in a 68-pin PLCC and is available in 16, 20, and
  1331.      25 MHz versions. Due to the advanced power saving features of the Cyrix
  1332.      coprocessor, the typical power consumption of the 20 MHz version is only
  1333.      about 350 mW [67].
  1334.  
  1335.  
  1336. ULSI Math*Co 83C87
  1337.  
  1338.      The ULSI 83C87 is an 80387-compatible coprocessor first introduced in
  1339.      early 1991, well after the IIT 3C87 and Cyrix 83D87 appeared. Like other
  1340.      387 clones, it is somewhat faster than the Intel 387DX, particularly in
  1341.      its basic arithmetic functions. The transcendental functions, however,
  1342.      show only a slight speed improvement over the Intel 387DX (see benchmark
  1343.      results below).
  1344.  
  1345.      In my tests, the ULSI had the most inaccurate transcendental functions
  1346.      of all tested coprocessors. However, the maximum relative error is still
  1347.      within the limits set by Intel, so this is probably not an important
  1348.      issue for all but a very few applications. The ULSI 83C87 shows some
  1349.      minor flaws in the tests for IEEE 754 compatibility, but this, too, is
  1350.      probably unimportant under typical operating conditions. ULSI claims
  1351.      that the program IEEETEST, which was used to test for IEEE
  1352.      compatibility, contains many personal interpretations of the IEEE
  1353.      standard by the program's author and states that there is no ANSI-
  1354.      certified IEEE-754 compliance test. While this may be true, it is
  1355.      also a fact that the IEEE test vectors used in IEEETEST are a de facto
  1356.      industry standard, and that Intel's 387, 486, and RapidCAD chips pass it
  1357.      without a single failure, as do the coprocessors from Cyrix. Since the
  1358.      ULSI Math*Co 83C87 fails some of the tests, it is certainly less than
  1359.      100% compatible with Intel's chips, although this will likely make
  1360.      little or no difference in typical operating conditions. (It is
  1361.      interesting to note that an ULSI 83S87 manufactured in 92/17 showed
  1362.      fewer errors in the IEEETEST test run [74] than the ULSI 83C87,
  1363.      manufactured in 91/48, I used in my original test. This indicates that
  1364.      ULSI might have applied some quick fixes to newer revisions of their
  1365.      math coprocessors.)
  1366.  
  1367.      The ULSI 83C87 fails to be compatible with the IEEE-754 in that is does
  1368.      not implement the "precision control" feature. While all the internal
  1369.      operations of 80x87 coprocessors are usually performed with the maximum
  1370.      precision available (double-extended precision with 64 mantissa bits),
  1371.      the 80x87 architecture also offer the possibility to force lower
  1372.      precision to be used for the basic arithmetic functions (add, subtract,
  1373.      multiply, divide, and square root). This feature is required by IEEE-754
  1374.      for all coprocessors that can not store results *directly* to a single
  1375.      or double-precision location. Since 80x87 coprocessors lack this storage
  1376.      capability, they all implement precision control to provide correctly
  1377.      rounded single- and double-precision results according to the floating-
  1378.      point standard - except the ULSI chips. For programs that make use of
  1379.      precision control (e.g., Interactive UNIX), correct implementation of
  1380.      the feature may be essential for correct arithmetic results.
  1381.  
  1382.      Like other non-Intel 387 compatibles, the 83C87 does not support
  1383.      asynchronous operation of the CPU and the coprocessor. This means that
  1384.      the 83C87 always runs at the full speed of the CPU. It is available in
  1385.      20, 25, 33, and 40 MHz versions. The ULSI is produced in low power CMOS;
  1386.      power consumption at 20 MHz is max. 800 mW (400 mW typical), at 25 MHz
  1387.      it is max. 1000 mW (500 mW typical), at 33 MHz it is max. 1250 mW (625
  1388.      mW), and at 40 MHz it is max. 1500 mW (750 mW typical) [58]. The 83C87
  1389.      is packaged in a 68-pin ceramic PGA.
  1390.  
  1391.      ULSI coprocessors come with a lifetime warranty. ULSI Systems, Inc.,
  1392.      will replace the coprocessor up to three times free of charge should it
  1393.      ever fail to function properly.
  1394.  
  1395.  
  1396. ULSI Math*Co 83S87
  1397.  
  1398.      This chip is the SX version of the ULSI 83C87, for use in systems with
  1399.      an Intel 387SX or an AMD Am387SX CPU. It is functionally equivalent to
  1400.      the 83C87. To aid low-power laptop designs, the ULSI 83S87 features an
  1401.      advanced power saving design with a sleep mode and a standby mode with
  1402.      only minimal power requirements. Power consumption under normal
  1403.      operating conditions (dynamic mode) is max. 400 mW at 16 MHz (300 mW
  1404.      typical), max. 450 mW at 20 MHz (350 mW typical), and max. 500 mW at 25
  1405.      MHz (400 mW typical) [58]. The ULSI 83S87 is packaged in a 68-pin PLCC.
  1406.  
  1407.  
  1408. C&T SuperMATH 38700DX
  1409.  
  1410.      Produced by Chips&Technologies, this is the latest entry into the 387-
  1411.      compatible marketplace. Originally announced in October, 1991, it has
  1412.      apparently not been available to end-users before the third quarter of
  1413.      1992, at least here in Germany. My tests show that its compatibility
  1414.      with Intel products is very good, even for the more arcane features of
  1415.      the 387DX and comparable to the coprocessors from Cyrix. Like these
  1416.      chips, it passes the IEEETEST program without a single failure. It
  1417.      passes, of course, all tests in Chips&Technologies' own compatibility
  1418.      test program, SMDIAG. However, some of the tests (the transcendental
  1419.      functions) in this program are selected in such a way that the C&T 38700
  1420.      passes while the Cyrix 83D87 or Intel RapidCAD fail, so they are not
  1421.      very useful. (There is also a 'bug' in the test for FSCALE that hides a
  1422.      true bug in the C&T 38700.) My tests show the accuracy of the
  1423.      transcendental functions on the C&T 38700DX varies. Overall, accuracy of
  1424.      the transcendentals is slightly better than on the Intel 387DX.
  1425.  
  1426.      In my own speed tests [see below] and those reported in [1], the C&T
  1427.      38700DX showed performance at about 90-100% the level of the Cyrix
  1428.      83D87, which is the 387 clone with the highest performance. For
  1429.      floating-point-intensive benchmarks, the C&T 38700DX provides up to 50%
  1430.      more computational performance than the Intel 387DX. However, as with
  1431.      all other 387 compatible coprocessors, the speed advantage over the
  1432.      Intel 387DX is far less significant in real applications.
  1433.  
  1434.      The SuperMATH 38700DX is implemented in 1.2 micron CMOS with on-chip
  1435.      power management, which makes for low power consumption. The 38700DX is
  1436.      packaged in a 68-pin ceramic PGA (pin grid array and available in speeds
  1437.      of 16, 20, 25, 33, and 40 MHz.
  1438.  
  1439.  
  1440. C&T 38700SX
  1441.  
  1442.      This chip is the SX version of the 38700DX and compatible with the Intel
  1443.      387SX. It provides performance comparable to a Cyrix 83S87 [1], the
  1444.      387SX clone with the highest performance. Compatibility with the Intel
  1445.      387SX is very good and on par with the high degree of the compatibility
  1446.      found in the Cyrix 83S87.
  1447.  
  1448.      The 38700SX has low power consumption. It is packaged in a 68-pin PLCC
  1449.      (plastic leaded chip carrier) and available in speeds of 16, 20, and 25
  1450.      MHz.
  1451.  
  1452.  
  1453. Intel RapidCAD
  1454.  
  1455.      The RapidCAD is not a coprocessor, strictly seen, although it is
  1456.      marketed as one. Rather, it is a full replacement for a 80386 CPU:
  1457.      basically, an Intel 486DX CPU chip without the internal cache and with a
  1458.      standard 386 pinout. RapidCAD is delivered as a set of two chips.
  1459.      RapidCAD-1 goes into the 386 socket and contains the CPU and FPU.
  1460.      RapidCAD-2 goes into the coprocessor (387) socket and contains a simple
  1461.      PAL whose only purpose is to generate the FERR signal normally generated
  1462.      by a coprocessor (This is needed by the motherboard circuitry to provide
  1463.      287 compatible coprocessor exception handling in 386/387 systems.) The
  1464.      RapidCAD instruction set is compatible with the 386, so it doesn't have
  1465.      any newer, 486-specific instructions like BSWAP. However, since the
  1466.      RapidCAD CPU core is very similar to 80486 CPU core, most of the
  1467.      register-to-register instructions execute in the same number of clock
  1468.      cycles as on the 486.
  1469.  
  1470.      RapidCAD's use of the standard 386 bus interface causes instructions
  1471.      that access memory to execute at about the same speed as on the 386. The
  1472.      integer performance on the RapidCAD is definitely limited by the low
  1473.      memory bandwidth provided by this interface (2 clock cycles per bus
  1474.      cycle) and the lack of an internal cache. CPU instructions often execute
  1475.      faster than they can be fetched from memory, even with a big and fast
  1476.      external cache. Therefore, the integer performance of the RapidCAD
  1477.      exceeds that of a 386 by *at most* 35%. This value was derived by
  1478.      running some programs that use mostly register-to-register operations
  1479.      and few memory accesses, and is supported by the SPEC ratings that Intel
  1480.      reports for the 386-33 and the RapidCAD-33: while the 386-33 has a
  1481.      SPECint of 6.4, the RapidCAD has a SPECint of 7.3 [28], a 14% increase.
  1482.      (Note that these tests used the old [1989] SPEC benchmarks suite.)
  1483.  
  1484.      While CPU and integer instructions often execute in one clock cycle on
  1485.      the RapidCAD, floating-point operations always take more than seven
  1486.      clock cycles. They are therefore rarely slowed down by the low-bandwidth
  1487.      386 bus interface; My tests show a 70%-100% performance increase for
  1488.      floating-point intensive benchmarks over a 386-based system using the
  1489.      Intel 387DX math coprocessor. This is consistent with the SPECfp rating
  1490.      reported by Intel. The 386/387 at 33 MHz is rated at 3.3 SPECfp, while
  1491.      the RapidCAD is rated at 6.1 SPECfp at the same frequency, an 85%
  1492.      increase. This means that a system that uses the RapidCAD is faster than
  1493.      *any* 386/387 combination, regardless of the type of 387 used, whether
  1494.      an Intel 387DX or a faster 387 clone. The diagnostic disk for the
  1495.      RapidCAD also gives some application performance data for the RapidCAD
  1496.      compared to the Intel 387DX:
  1497.  
  1498.              Application      Time w/ 387DX  Time w/ RapidCAD  Speedup
  1499.  
  1500.              AutoCAD 11              52 sec         32 sec       63%
  1501.              AutoShade/Renderman    180 sec        108 sec       67%
  1502.              Mathematica(Windows  ) 139 sec        103 sec       35%
  1503.              SPSS/PC+ 4.01           17 sec         14 sec       21%
  1504.  
  1505.      RapidCAD is available in 25 MHz and 33 MHz versions. It is distributed
  1506.      through different channels than the other Intel math coprocessors, and I
  1507.      have therefore been unable to obtain a data sheet for it. [78] gives the
  1508.      typical power consumption of the 33 MHz RapidCAD as 3500 mW, which is
  1509.      the same as for the 33 MHz 486DX. The RapidCAD-1 chip gets quite hot
  1510.      when operating. Therefore, I recommend extra cooling for it (see the
  1511.      paragraph below on the 486 for details). The RapidCAD-1 is packaged in a
  1512.      132-pin PGA, just like the 80386, and the RapidCAD-2 is packaged in a
  1513.      68-pin PGA like a 80387 coprocessor.
  1514.  
  1515.  
  1516. Intel 486DX
  1517.  
  1518.      The Intel 486DX is, of course, not solely a coprocessor. This chip,
  1519.      first introduced by Intel in 1989, functionally combines the CPU (a
  1520.      heavily-pipelined implementation of the 386 architecture) with an
  1521.      enhanced 387 (the chip's floating-point unit, FPU) and 8 KB of unified
  1522.      on-chip code/data cache. (This description is necessarily simplified;
  1523.      for a detailed hardware description, see [52].) The 486DX offers about
  1524.      two to three times the integer performance of a 386 at the same clock
  1525.      frequency, while floating-point performance is about three to four times
  1526.      as high as the Intel 387DX at the same clock rate [29]. Since the FPU is
  1527.      on the same chip as the CPU, the considerable communication overhead
  1528.      between CPU and coprocessor in a 386/387 system is omitted, letting FPU
  1529.      instructions run at the full speed permitted by the implementation. The
  1530.      FPU also takes advantage of the on-chip cache and the highly pipelined
  1531.      execution unit. The concurrent execution of CPU and coprocessor
  1532.      instructions typical for 80x86/80x87 systems is still in existence on
  1533.      the 486, but some FPU instructions like FSIN have nearly no concurrency
  1534.      with CPU instructions, indicating that they make heavy use of both, CPU
  1535.      and FPU resources [53, 1].
  1536.  
  1537.      Besides its higher performance, the 486 FPU provides more accurate
  1538.      transcendental functions than the 387DX coprocessor, according to my
  1539.      tests (see below). To achieve better interrupt latency, FPU instructions
  1540.      with a long execution times have been made abortable if an interrupt
  1541.      occurs during their execution.
  1542.  
  1543.      Due to the considerable amount of heat produced by these chips, and
  1544.      taking into consideration the slow air flow provided by the fan in
  1545.      garden-variety PC tower cases, I recommend an extra fan directly above
  1546.      the CPU for safer operation. If you measure the surface temperature of
  1547.      an 486DX after some time of operation in a normal tower case without
  1548.      extra cooling, you may well come up with something like 80-90 degrees
  1549.      Celsius (that is 175-195 degrees Fahrenheit for those not familiar with
  1550.      metric units) [54,55]. You don't need the well known (and expensive)
  1551.      IceCap[tm] to effectively cool your CPU; a simple fan mounted directly
  1552.      above the CPU can bring the temperature of the chip down to about 50-60
  1553.      degrees Celsius (120-140 degrees Fahrenheit), depending on the room
  1554.      temperature and the temperature within the PC case (which depends on the
  1555.      total power dissipation of all the components and the cooling provided
  1556.      by the fan in the system's power supply). According to a simple rule
  1557.      known as Arrhenius' Law, lowering the temperature by 10 degrees Celsius
  1558.      slows down chemical reactions by a factor of two, so lowering the
  1559.      temperature of your CPU by 30 degrees should prolong the life of the
  1560.      device by a factor of eight, due to the slower ageing process. If you
  1561.      are reluctant to add a fan to your system because of the additional
  1562.      noise, settle for a low-noise fan like those available from the German
  1563.      manufacturer Pabst (this is not meant to be an advertisement; I am just
  1564.      the happy owner of such a fan, and have no other connections to the
  1565.      firm).
  1566.  
  1567.      The 486DX comes in a 168 pin ceramic PGA (pin grid array). It is
  1568.      available in 25 MHz and 33 MHz versions. Since the end of 1991, a 50 MHz
  1569.      version has also been available, manufactured by a CHMOS V process (the
  1570.      25 MHz and 33 MHz are produced using the CHMOS IV process). Maximum
  1571.      power consumption is 3500 mW for the 25 MHz 486 (2600 mW typical), 4500
  1572.      mW for the 33 MHz version (3500 mW typical), and 5000 mW (3875 mW
  1573.      typical) for the 50 MHz chip.
  1574.  
  1575.  
  1576. Intel 486DX2
  1577.  
  1578.      The 486DX2 represents the latest generation of Intel CPUs. The "DX2"
  1579.      suffix (instead of simply DX) is meant to be an indicator that these are
  1580.      clock-doubled versions of the basic CPU. A normal 486DX operates at the
  1581.      frequency provided by the incoming clock signal. A 486DX2 instead
  1582.      generates a new clock signal from the incoming clock by means of a PLL
  1583.      (phase locked loop). In the DX2, this clock signal has twice the
  1584.      frequency of the incoming clock, hence the name clock-doubler. All
  1585.      internal parts of the 486DX2 (cache, CPU core, and FPU) run at this
  1586.      higher frequency; only the bus interface runs at the normal (undoubled)
  1587.      speed. Using this technique, an Intel 486DX2-50 can run on an unmodified
  1588.      motherboard designed for 25 MHz operation. Since motherboards which run
  1589.      at 50 MHz are much harder to design and build than those for 25 MHz,
  1590.      this makes a 486DX2-50 system cheaper than an 'equivalent' 486DX-50
  1591.      system.
  1592.  
  1593.      For all operations that don't access off-chip resources (e.g., register
  1594.      operations), a 486DX2-50 provides exactly the same performance as a
  1595.      486DX-50, and twice the performance of a 486DX-25. However, since the
  1596.      main memory in a 486DX2-50 systems still operates at 25 MHz, all
  1597.      instructions involving memory accesses are potentially slower than in a
  1598.      486DX-50 system, whose memory also (presumably) runs at 50 MHz. The
  1599.      internal cache of the 486 helps this problem a bit, but overall
  1600.      performance of a 486DX2-50 is still lower than that of a 486DX-50.
  1601.      Intel's documentation [32] shows this drop to be quite small, although
  1602.      it is highly dependent upon the particular application.
  1603.  
  1604.      The truly wonderful thing about the 486DX2 is that it allows easy
  1605.      upgrading of 25 and 33 MHz 486 systems, since the 486DX2 is completely
  1606.      pin-compatible with the 486DX: you need just take out the 486DX and plug
  1607.      in the new 486DX2. Note that power consumption of the 486DX2-50 equals
  1608.      that of the 486DX-50 (4000 mW typical, 4750 mW max.), and that the
  1609.      486DX2-66 exceeds this by about 25% (4875 mW typical, 6000 mW max.).
  1610.      These chips get *really* hot in a standard PC case with no extra
  1611.      cooling, even if they come with an attached heat sink by default. (See
  1612.      the discussion above for more detailed information on this problem and
  1613.      possible solutions).
  1614.  
  1615.  
  1616. Intel 487SX
  1617.  
  1618.      The 487SX is the math coprocessor intended for use in 486SX systems. The
  1619.      486SX is basically a 486DX without the floating-point unit (FPU) [48,
  1620.      50]. (Originally Intel sold 486DXs with a defective FPU as 486SXs but it
  1621.      has now completely removed the FPU part from the 486SX mask for mass
  1622.      production.) The introduction of the 486SX in 1991 has been viewed by
  1623.      many as a marketing 'trick' by Intel to take market share from the 386
  1624.      based systems once AMD became successful with their Am386. (AMD has
  1625.      taken as much as 40% of the 386 market due to some superior features
  1626.      such as higher clock frequency, lower power consumption, fully static
  1627.      design, and availability of a 3V version). A 486SX at 20 MHz delivers
  1628.      a bit less integer performance than a 40 MHz Am386.
  1629.  
  1630.      To add floating-point capabilities to a 486SX based system, it would
  1631.      seem to be easiest to swap the 486SX for a 486DX, which includes the FPU
  1632.      on-chip. However, Intel has prevented this easy solution by giving the
  1633.      486SX a slightly different pin out [48, 51]. Since only three pins are
  1634.      assigned differently, clever board manufacturers have come out with
  1635.      boards that accept anything from a 486SX-20 to a 486DX2-50 in their CPU
  1636.      socket and by doing so provide a clean upgrade path. A set of three
  1637.      jumpers ensures correct signal assignment to the changed pins for either
  1638.      CPU type. To upgrade 486SX systems without this feature, you are forced
  1639.      to buy a 487SX and install it in the "Performance Upgrade Socket"
  1640.      (present in most systems).
  1641.  
  1642.      Once the 487SX was available, it was quickly found out that it is just a
  1643.      normal 486DX with a slightly different pinout [49]. Technically
  1644.      speaking, the solution Intel chose was the only practical way to provide
  1645.      a 486SX system with the high level of floating-point performance the
  1646.      486DX offers. The CPU and FPU must be on the same chip; otherwise, the
  1647.      FPU cannot make use of the CPU's internal cache and there would be
  1648.      considerable overhead in CPU-FPU communication (similar to a 386/387
  1649.      system), nullifying most of the arithmetic speedups over the 387. That
  1650.      the 486SX, 487SX, and 486DX are *not* pin-compatible seems to be purely
  1651.      for marketing reasons.
  1652.  
  1653.      To upgrade a 486SX based system, Intel also offers the OverDrive chip,
  1654.      which is just the same as a 487SX with internal clock doubling. It also
  1655.      goes into the motherboard's "Performance Upgrade Socket". The OverDrive
  1656.      roughly doubles the performance of a 486SX/487SX based system. (For a
  1657.      explanation of clock doubling, see the description of the Intel 486DX2
  1658.      above.)
  1659.  
  1660.      Inserting the 487SX effectively shuts down the 486SX in the 486SX/487SX
  1661.      system, so the 486SX could be removed once the 487SX is installed. Since
  1662.      the shut down is logical, not electrical, the 486SX still uses power if
  1663.      used with the 487SX, although it is inoperational. As with the 486SX,
  1664.      the 487SX is currently available in 20 MHz and 25 MHz versions. At 20
  1665.      MHz, the 487SX has a power consumption of max. 4000 mW (3250 mW
  1666.      typical). It is available in a 169 pin ceramic PGA (pin grid array).
  1667.  
  1668.  
  1669. Weitek 1167
  1670.  
  1671.      This math coprocessor was the predecessor of the Weitek Abacus 3167. It
  1672.      was actually a small printed circuit board with three chips mounted on
  1673.      it. In contrast to the Weitek 3167, the 1167 did not have a square root
  1674.      instruction; instead, the square root function was computed by means of
  1675.      a subroutine in the Weitek transcendental function library. However, the
  1676.      1167 did have a mode in which it supported denormal numbers. (The Weitek
  1677.      3167 and 4167 only implement the 'fast' mode, in which denormals are not
  1678.      supported.) Overall performance of the 1167 is slightly less than that
  1679.      of the Weitek 3167.
  1680.  
  1681.  
  1682. Weitek 3167
  1683.  
  1684.      The 3167 was introduced by Weitek in 1989 and provided the fastest
  1685.      floating-point performance possible on a 386 based system at that time.
  1686.      The 3167 is not a real coprocessor, strictly speaking, but rather a
  1687.      memory-mapped peripheral device. The architecture of the 3167 was
  1688.      optimized for speed wherever possible. Besides using the faster memory
  1689.      mapped interface to the CPU (the 80x87 uses IO-ports), it does not
  1690.      support many of the features of the 80x87 coprocessors, allowing all of
  1691.      the chip's resources to be concentrated on the fast execution of the
  1692.      basic arithmetic operations. (For a more detailed description of the
  1693.      Weitek 3167, see the first chapter of this document.)
  1694.  
  1695.      In benchmark comparisons, the Weitek 3167 provided up to 2.5 times the
  1696.      performance of an Intel 387DX coprocessor. For example, on a 33 MHz 3167
  1697.      the Whetstone benchmark performed at 7574 kWhetstones/sec compared with
  1698.      the 3743 kWhetstones/s for the Intel 387DX. (Note, however, that these
  1699.      are single-precision results and that the Weitek 3167's performance
  1700.      would drop to about half the stated rate for double-precision, while the
  1701.      value for the Intel 387DX would change very little.) In any case, before
  1702.      the advent of the Intel RapidCAD, the Weitek 3167 usually outperformed
  1703.      all 387-compatible coprocessors, even for double-precision operations
  1704.      [63,65,69]. For typical applications, the advantage of the Weitek 3167
  1705.      over the 387 clones is much smaller. In a benchmark test using
  1706.      AutoDesk's 3D-Studio the Weitek 3167 performed at 123% of the Intel
  1707.      387DX's performance compared with 106% for the Cyrix FasMath 83D87 and
  1708.      118% for the Intel RapidCAD.
  1709.  
  1710.      The Weitek Abacus 3167 is packaged in a 121-pin PGA that fits into an
  1711.      EMC socket (provided in most 386-based systems). It does *not* fit into
  1712.      the normal 68-pin PGA socket intended for a 387 coprocessor.
  1713.  
  1714.      To get the best of both worlds, one might want to use a Weitek 3167 and
  1715.      a 387 compatible coprocessor in the same system. These coprocessors can
  1716.      coexist in the same system without problems; however, most 386-based
  1717.      systems contain only one coprocessor socket, usually of the EMC
  1718.      (extended math coprocessor) type. Thus, you can install either a 387
  1719.      coprocessor or a Weitek 3167, but not both at the same time. There *are*
  1720.      small daughter boards available that plug into the EMC socket and
  1721.      provide two sockets, an EMC and a standard coprocessor socket.
  1722.  
  1723.      At 25 MHz, the Weitek 3167 has a power consumption of max. 1750 mW. At
  1724.      33 MHz, max. power consumption is 2250 mW.
  1725.  
  1726.  
  1727. Weitek 4167
  1728.  
  1729.      The 4167 is a memory-mapped coprocessor that has the same architecture
  1730.      as the 3167; it is designed to provide 486-based systems with the
  1731.      highest floating-point performance available. It executes coprocessor
  1732.      instructions at three to four times the speed of the Weitek 3167.
  1733.      Although it is up to 80% faster than the Intel 486 in some benchmarks
  1734.      [1,69], the performance advantage for real application is probably more
  1735.      like 10%. The introduction of the 486DX2 processors has more or less
  1736.      obliterated the need for a Weitek 4167, since the DX2 CPUs provide the
  1737.      same performance as the Weitek, as well as the additional features the
  1738.      80x87 architecture has that the Weitek does not.
  1739.  
  1740.      The Weitek 4167 is packaged in a 142-pin PGA package that is only
  1741.      slightly smaller than the 486's package. At 25 MHz, it has a max. power
  1742.      consumption of 2500 mW [32].
  1743.  
  1744.  
  1745.  
  1746. ======================================
  1747. Finding out which coprocessor you have
  1748. ======================================
  1749.  
  1750. If you are interested in programming techniques which allow the detection and
  1751. differentiation of the coprocessors described above, I refer you to my
  1752. COMPTEST program. COMPTEST reliably detects the type and clock frequency of
  1753. the CPU and coprocessor installed in your machine. The current version is
  1754. CTEST257.ZIP, with future versions to be called CTEST258, CTEST259 and so on.
  1755. COMPTEST can correctly identify all of the coprocessors described above, with
  1756. the exception of the Weitek chips, for which the detection mechanism is not
  1757. that reliable.
  1758.  
  1759. COMPTEST is in the public domain and comes with complete source code. It is
  1760. available via anonymous ftp from garbo.uwasa.fi and additional ftp sites that
  1761. mirror garbo.
  1762.  
  1763.  
  1764.  
  1765. ================================================
  1766. Current coprocessor prices and purchasing advice
  1767. ================================================
  1768.  
  1769. Due to mid-1992 price slashing by Cyrix (and subsequently, Intel) for 387
  1770. coprocessors, prices have dropped significantly for all 287 and 387
  1771. compatibles, with hardly any price difference between manufacturers. 387DX
  1772. compatible coprocessors typically sell for ~US$ 80 for all speeds except for
  1773. 40 MHz versions, which are typically ~US$ 90. 387SX compatible coprocessors
  1774. sell for ~US$ 70, regardless of speed, with the exception of the 33 MHz
  1775. versions, which are ~US$ 80. The Intel 287XL sells for ~US$ 90, while the
  1776. IIT 2C87 and Cyrix 82S87 each sell for about US$ 60. 8087s may be more
  1777. expensive, the price of an 8087-10 being ~US$ 150. I purchased the Intel
  1778. RapidCAD for US$ 300 and haven't seen it offered for a better price. I see the
  1779. Weitek Abacus 3167-33 being offered for US$ 230 and the 4167-33 being offered
  1780. for US$ 850. The Intel 486SX OverDrive is available for ~US$ 570 for the 20 MHz
  1781. version, while the Intel 486DX2-50 costs ~650 US$. This price information
  1782. reflects the price situation as of 01-11-93; prices can be expected to drop
  1783. slightly in the near future.
  1784.  
  1785.  
  1786. Which coprocessor should you buy?
  1787. ---------------------------------
  1788. Several computer magazines have published application-level performance
  1789. comparisons for various 387 coprocessors and Weitek's ABACUS 3167 and 4167
  1790. chips [1,25,68,70]. Applications tested included AutoCAD R11, RenderStar,
  1791. Quattro Pro, Lotus 1-2-3, and AutoDesk's 3D-Studio. For most tests,
  1792. performance improvements for the 387 clones over Intel's 387DX were small to
  1793. marginal, the clones running the applications no more than 5-15% faster than
  1794. the Intel 387DX. In the test of 3D-Studio, one of the few programs that
  1795. directly supports the Weitek Abacus, the Weitek 3167 improved performance by
  1796. 23% over an Intel 387DX and the 4167 improved performance by 10% over the
  1797. 486DX [1].
  1798.  
  1799. If you have a demand for high floating-point performance, you should consider
  1800. buying a full 486-based system, rather than a 386-based system with an
  1801. additional coprocessor. Consider: A 386/33 MHz motherboard currently sells for
  1802. ~US$ 270; together with the coprocessor, the cost totals ~US$ 350. A 486/33 MHz
  1803. ISA motherboard sells for US$ 650. While this means that the 486 system is 85%
  1804. more expensive than the 386/387 system, it also provides 100% more integer
  1805. and floating-point performance (twice the performance), giving it better
  1806. price/performance for math-intensive applications. As prices for 486 chips
  1807. fall in the future, the price difference between these two systems should
  1808. become even smaller.
  1809.  
  1810. If you want to push your 386-based system to its maximum floating-point
  1811. performance and can't switch to a 486, I recommend the Intel RapidCAD
  1812. chipset. It is both faster [1] and cheaper than installing a Weitek Abacus
  1813. 3167 in a 386 system, which used to be the highest performing combination
  1814. before the RapidCAD was introduced.
  1815.  
  1816. In a similar vein, the introduction of the Intel 486DX2 clock-doubler chips
  1817. has obliterated the need for a Weitek 4167 to get maximum floating-point
  1818. performance out of a 486-based system. A 486DX2-66 performs at or above the
  1819. performance level of a 33 MHz Weitek 4167, even if the latter uses single-
  1820. precision rather than double-precision. The 486DX-66 is rated by Intel at
  1821. 24700 double-precision kWhetstones/sec and 3.1 double-precision Linpack
  1822. MFLOPS. (Of course, these benchmarks used the highest performance compilers
  1823. available. But even with a Turbo Pascal 6.0 program, I managed to squeeze 1.6
  1824. double-precision MFLOPS out of the 486DX2-66 for the LLL benchmark [for a
  1825. description of these benchmarks, see the paragraph on benchmarks below].)
  1826. Although I haven't yet seen 486DX2-66 processors being offered to end users
  1827. for upgrade purposes, I recommend the 486DX2-66 to those that need highest
  1828. floating-point performance and are planning to buy a new PC. The price
  1829. difference between a 33 MHz 486DX motherboard and a 486DX2-66 motherboard is
  1830. around US$ 450, well below the price for the Weitek Abacus 4167.
  1831.  
  1832.  
  1833.  
  1834. ============================================================
  1835. The benchmark programs / Coprocessor performance comparisons
  1836. ============================================================
  1837.  
  1838. The performance statistics below were put together with the help of four
  1839. widely-known numeric benchmarks and two benchmarks developed by me. Three
  1840. Pascal programs, one FORTRAN program, and two assembly language programs were
  1841. used. The assembly language programs were linked with Borland's Turbo Pascal
  1842. 6.0 for library support, especially to include the coprocessor emulator of
  1843. the TP 6.0 run-time library. The Pascal programs were compiled with Turbo
  1844. Pascal 6.0, a non-optimizing compiler that produces 16-bit code. The FORTRAN
  1845. program was compiled using Microsoft's FORTRAN 5.0, an optimizing compiler
  1846. that generates 16-bit code. All programs use double-precision variables
  1847. (except PEAKFLOP and SAVAGE, which use double extended precision).
  1848.  
  1849. Note that the use of a highly optimizing compiler producing 32-bit code can
  1850. give much higher performance for some benchmarks. For example, Intel rates
  1851. the 33 MHz 386/387DX at 3290 kWhetstones/sec and 0.4 double-precision LINPACK
  1852. MFLOPS [28,29], and it rates the Intel 486 at 12300 kWhetstones/sec and 1.6
  1853. double-precision LINPACK MFLOPS [30]. The compilers used in these benchmarks
  1854. run by the chip's manufacturer are the ones that give the highest performance
  1855. available, and sell in the US$ 1000+ price range. Some of them may even be
  1856. experimental or prereleased versions not available to the general public. The
  1857. relative performance of one coprocessor to another can and does vary greatly
  1858. depending on the code generated by compilers. Non-optimizing compilers tend
  1859. to generate a high percentage of operations which access variables in memory,
  1860. while optimizing compiler produce code that contains many operations
  1861. involving registers. Thus it is well possible that coprocessor A beats
  1862. coprocessor B running benchmark Z if compiled with compiler C, but B beats A
  1863. when the same benchmark is compiled using compiler D.
  1864.  
  1865. All benchmark in this overview were run from floppy under a 'bare-bones' MS-
  1866. DOS 5.0 without the CONFIG.SYS and AUTOEXEC.BAT files. This way, it was made
  1867. sure no TSR or other program unnecessarily stole computing resources from the
  1868. benchmarks.
  1869.  
  1870.  
  1871. Description of benchmarks
  1872. -------------------------
  1873. PEAKFLOP is the kernel of a fractal computation. It consists mainly of a
  1874. tight loop written in assembly code and fine-tuned to give maximum
  1875. performance. The whole program fits nicely into even a very small CPU cache.
  1876. All variables are held in the CPU's and coprocessor's registers, so the only
  1877. memory access is for opcode fetches. The main loop contains three
  1878. multiplications and five additions/ subtractions; this ratio is fairly
  1879. typical for other floating-point intensive programs as well. Due to the
  1880. nature of this program, its MFLOPS rate is hardly to be exceeded by any
  1881. program that calculates anything useful; thus the name PEAKFLOP. You will
  1882. find the source code for PEAKFLOP in appendix B.
  1883.  
  1884. TRNSFORM multiplies an array of 8191 vectors with a 3D-transformation matrix
  1885. (a 4x4 matrix). Each vector consists of four double-precision values.
  1886. Multiplying vectors with a matrix is a typical operation in the manipulation
  1887. (e.g. rotation) of 3D objects which are made up from many vectors describing
  1888. the object. This benchmark stresses addition and multiplication as well as
  1889. memory access. For each vector, 16 multiplications and 12 additions are used,
  1890. and about 256 KB of data is accessed during the benchmark run.
  1891.  
  1892. For the IIT 3C87, a special version of TRNSFORM was written that makes use of
  1893. the special F4X4 instruction available on that coprocessor. F4X4 does a full
  1894. multiplication of a 4x4 matrix by a 4x1 vector in a single instruction.
  1895. TRNSFORM is implemented as an optimized assembler program linked with the
  1896. Turbo Pascal 6.0 library. The full source code can be found in appendix B.
  1897.  
  1898. LLL is short for Lawrence Livermore Loops [21], a set of kernels taken from
  1899. real floating-point extensive programs. Some of these loops are vectorizable,
  1900. but since we don't deal with vector processors here, this doesn't matter. For
  1901. this test, LLL was adapted from the FORTRAN original [20] to Turbo Pascal
  1902. 6.0. By variable overlaying (similar to FORTRAN's EQUIVALENCE statement),
  1903. memory allocation for data was reduced to 64 KB, so all data fits into a
  1904. single 64 KB segment. The older version of LLL is used here which contains 14
  1905. loops. There also exists a newer, more elaborate version consisting of 24
  1906. kernels. The kernels in LLL exercise only multiplication and addition. The
  1907. MFLOPS rate reported is the average of the MFLOPS rate of all 14 kernels.
  1908. All floating-point variables in the programs are of type DOUBLE.
  1909.  
  1910. Both LLL and Whetstone results (see below) are reported as returned by my
  1911. COMPTEST test program, in which they have been included as a measure of
  1912. coprocessor/FPU performance. COMPTEST has been compiled under Turbo Pascal
  1913. 6.0 with all 'optimizations' on and using my own run-time library, which
  1914. gives higher performance than the one included with TP 6.0. My library is
  1915. available as TPL60N18.ZIP from garbo.uwasa.fi and ftp sites that mirror this
  1916. site.
  1917.  
  1918. Linpack [5] is a well known floating-point benchmark that also heavily
  1919. exercises the memory system. Linpack operates on large matrices and takes up
  1920. about 570 KB in the version used for this test. This is about the largest
  1921. program size a pure DOS system can accommodate. Linpack was originally
  1922. designed to estimate performance of BLAS, a library of FORTRAN subroutines
  1923. that handles various vector and matrix operations. Note that vendors are
  1924. free to supply optimized (e.g., assembly language) versions of BLAS. Linpack
  1925. uses two routines from BLAS which are thought to be typical of the matrix
  1926. operations used by BLAS. Both routines only use addition/subtraction and
  1927. multiplication. The FORTRAN source code for Linpack can be obtained from
  1928. the automated mail server netlib@ornl.gov. Linpack was compiled using MS
  1929. FORTRAN 5.0 in the HUGE memory model (which can handle data structures
  1930. larger than 64 KB) and with compiler switches set for maximum optimization.
  1931. All floating-point variables in the program are of the DOUBLE type. Linpack
  1932. performs the same test repeatedly. The number reported is the maximum MFLOPS
  1933. rate returned by Linpack. Linpack MFLOPS ratings for a great number of
  1934. machines are contained in [6]. This PostScript document is also available
  1935. from netlib@ornl.gov.
  1936.  
  1937. Whetstone [2,3,4] is a synthetic benchmark based upon statistics collected
  1938. about the use of certain control and data structures in programs written in
  1939. high level languages. Based on these statistics, it tries to mirror a
  1940. 'typical' HLL program. Whetstone performance is expressed by how many
  1941. hypothetical 'whetstone' instructions are executed per second. It was
  1942. originally implemented in ALGOL. Unlike PEAKFLOP, LLL, and Linpack,
  1943. Whetstone not only uses addition and multiplication but exercises all basic
  1944. arithmetic operations as well as some transcendental functions. Whetstone
  1945. performance depends on the speed of the CPU as well as on the coprocessor,
  1946. while PEAKFLOP, LLL, and Linpack place a heavier burden on the coprocessor/FPU.
  1947.  
  1948. There exist both old and new versions of Whetstone. Note that results from
  1949. the two versions can differ by as much as 20% for the same test configuration.
  1950. For this test, the new version in Pascal from [3] was used. It was compiled
  1951. with Turbo Pascal 6.0 and my own library (see above) with all 'optimizations'
  1952. on. All computations are performed using the DOUBLE type.
  1953.  
  1954. SAVAGE tests the performance of transcendental function evaluation. It is
  1955. basically a small loop in which the sin, cos, arctan, ln, exp, and sqrt
  1956. functions are combined in a single expression. While sin, cos, arctan, and
  1957. sqrt can be evaluated directly with a single 387 coprocessor instruction
  1958. each, ln and exp need additional preprocessing for argument reduction and
  1959. result conversion. According to [14], the Savage benchmark was devised by
  1960. Bill Savage, and is distributed by: The Wohl Engine Company, Ltd., 8200 Shore
  1961. Front Parkway, Rockaway Beach, NY 11693, USA. Usually, Savage is programmed
  1962. to make 250,000 passes though the loop. Here only 10,000 loops are executed
  1963. for a total of 60,000 transcendental function evaluations. The result is
  1964. expressed in function evaluations per second. SAVAGE source code was taken
  1965. from [7] and compiled with Turbo Pascal 6.0 and my own run-time library
  1966. (see above).
  1967.  
  1968.  
  1969.  
  1970. Benchmark results using the Intel 386DX CPU and various coprocessors
  1971. --------------------------------------------------------------------
  1972.  
  1973. My benchmark results for 387 coprocessors, coprocessor emulators and the
  1974. Intel RapidCAD and Intel 486 CPUs, using the programs described above, on
  1975. an Intel 386DX system:
  1976.  
  1977.  
  1978.        33.3 MHz       PEAKFLOP TRNSFORM LLL     Linpack Whetstone Savage
  1979.                       MFLOPS   MFLOPS   MFLOPS  MFLOPS  kWhet/sec Func/sec
  1980.  
  1981.        Intel 386DX WITH:
  1982.        EM87 emulator  0.0070   0.0040   0.0050  0.0050         26      418 ##
  1983.        Franke387 emu. 0.0307   0.0246   0.0194  0.0179        137     3335 $$
  1984.        TP/MS-FORT emu 0.0263   0.0227   0.0167  0.0158        133     3160 %%
  1985.        Q387 emulator  0.0920   0.0664   0.0305  0.0304        251     4796 ((
  1986.        Intel 387DX    0.7647   0.6004   0.3283  0.2676       2046    43860
  1987.        ULSI 83C87     1.0097   0.6609   0.3239  0.2598       2089    47431
  1988.        IIT 3C87       0.8455   0.5957   0.3198  0.2646       2203    49020
  1989.        IIT 3C87,4X4   0.8455   1.4334   0.3198  0.2646       2203    49020 @@
  1990.        C&T 38700      0.9455   0.6907   0.3338  0.2700       2376    62565
  1991.        Cyrix 387+     0.9286   0.6806   0.3293  0.2669       2435    66890
  1992.        Cyrix EMC87    1.0400   0.6628   0.3352  0.2808       2540    71685 //
  1993.  
  1994.        Intel RapidCAD 1.8572   1.5798   0.6072  0.4533       3953    72464
  1995.        Intel 486DX    2.0800   1.7779   0.9387  0.6682       5143    82192
  1996.  
  1997.  
  1998.  
  1999.        40 MHz         PEAKFLOP TRNSFORM LLL     Linpack Whetstone Savage
  2000.                       MFLOPS   MFLOPS   MFLOPS  MFLOPS  kWhet/sec Func/sec
  2001.  
  2002.        Intel 386DX WITH:
  2003.        EM87 emulator  0.0084   0.0080   0.0060  0.0060         31      502 ##
  2004.        Franke387 emu. 0.0369   0.0295   0.0233  0.0215        164     4002 $$
  2005.        TP/MS-FORT emu 0.0316   0.0273   0.0200  0.0190        160     3794 %%
  2006.        Q387 emulator  0.1103   0.0798   0.0365  0.0364        301     5758 ((
  2007.        Intel 387DX    0.9204   0.7212   0.3932  0.3211       2428    52677
  2008.        ULSI 83C87     1.2093   0.7936   0.3890  0.3120       2528    56926
  2009.        IIT 3C87       1.0196   0.7145   0.3834  0.3179       2663    58766
  2010.        IIT 3C87,4x4   1.0196   1.7244   0.3834  0.3179       2663    58766 @@
  2011.        C&T 38700      1.0722   0.7908   0.4007  0.3222       2837    74906
  2012.        Cyrix 387+     1.1305   0.8162   0.3945  0.3208       2946    80322
  2013.        Cyrix EMC87    1.2381   0.7963   0.4025  0.3324       3061    86083 //
  2014.  
  2015.        Intel RapidCAD 2.2128   1.8931   0.7377  0.5432       4810    86957
  2016.        Intel 486DX    2.4762   2.1335   1.1110  0.8204       6195    98522
  2017.  
  2018.  
  2019.  
  2020. Benchmark results using the Cyrix 486DLC CPU and various coprocessors
  2021. ---------------------------------------------------------------------
  2022.  
  2023. The Cyrix 486DLC is the latest entry into the market of 386DX replacement
  2024. processors. It features an Intel 486SX-compatible instruction set, a 1 KB on-
  2025. chip cache, and a 16x16 bit hardware multiplier. The RISC-like execution unit
  2026. of the 486DLC executes many instructions in a single clock cycle. The
  2027. hardware multiplier multiplies 16-bit quantities in 3 clock cycles, as
  2028. compared to 12-25 cycles on a standard Intel 386DX. This is especially useful
  2029. in address calculations (code from non-optimizing compilers may contain many
  2030. MUL instructions for array accesses) and for software floating-point
  2031. arithmetic. The 1 KB cache helps the 486DLC to overcome some of the
  2032. limitations of the 386 bus interface, and although its hit rate averages only
  2033. about 65% under normal program conditions, a 5-15% overall performance
  2034. increase can usually be seen for both integer and floating-point-intensive
  2035. applications when it is enabled.
  2036.  
  2037. The 486DLC's internal cache is a unified data/instruction write-through type,
  2038. and can be configured as either a direct mapped or a 2-way set associative
  2039. cache. For compatibility reasons, the cache is disabled after a processor
  2040. reset and must be enabled with the help of a small routine provided by
  2041. Cyrix. Cyrix has also defined some additional cache control signals for some
  2042. of the 486DLC pins, intended to improve communication between the on-chip
  2043. cache and an external cache. Current 386 systems ignore these signals, since
  2044. they are not defined for the standard Intel 386DX. However, future systems
  2045. designed with the 486DLC in mind may take advantage of them for increased
  2046. performance.
  2047.  
  2048. In existing 386 systems, DMA transfers (e.g., by a SCSI controller or a
  2049. soundcard) may cause the 486DLC's entire on-chip cache to be flushed, since
  2050. no other means exist to enforce consistency between the cache contents and
  2051. main memory. This reduces the performance of the 486DLC in these cases. The
  2052. 486DLC on-chip cache does, however, allow specification of up to four non-
  2053. cacheable regions, which is particularly useful if your system has memory
  2054. mapped peripherals (e.g., a Weitek coprocessor).
  2055.  
  2056. Although I successfully ran my test programs on the Cyrix chip with all
  2057. coprocessors, not all of them work well with the 486DLC in all circumstances.
  2058. The IIT 3C87, the Cyrix 83D87 (chips manufactured prior to November 1991),
  2059. and the Cyrix EMC87 should not be used with the 486DLC, since they may cause
  2060. the computer to lock up if the FSAVE and FRSTOR instructions are used. (These
  2061. instructions are typically used in protected mode multiple task environments
  2062. to save and restore the coprocessor state for each task. Note that Microsoft
  2063. Windows also fits this description.) According to Cyrix, this problem occurs
  2064. only with first revision 486DLCs (sample chips) and is fixed on newer ones.
  2065. To be on the safe side, I recommend using the Cyrix 387+ with the 486DLC,
  2066. both for assured compatibility and for best performance. Note that 387+ is a
  2067. 'Europe only' name and that this chip is called 83D87 elsewhere, just like
  2068. the old version. You need to get a 83D87 produced after about October 1991
  2069. to guarantee that is works correctly with any 486DLC; the same caveat applies
  2070. to the Cyrix 486SLC and the Cyrix 83S87. If you already have a Cyrix
  2071. coprocessor, use my COMPTEST program to find out whether you have a 'new' or
  2072. 'old' coprocessor. COMPTEST is available as CTEST257.ZIP via anonymous ftp
  2073. from garbo.uwasa.fi (in the /systest directory) and other ftp servers that
  2074. mirror garbo.
  2075.  
  2076. The Cyrix 486DLC is currently the 386 'clone' with the highest integer
  2077. performance. With the internal cache enabled, integer performance of the
  2078. 486DLC can be up to 80% higher than that of an Intel 386DX at the same clock
  2079. frequency, with the average speed gain for most applications being about 35%.
  2080. Floating-point applications are typically accelerated by about 15%-30% when
  2081. using a Cyrix 486DLC (with its cache enabled) instead of the Intel 386DX.
  2082.  
  2083.  
  2084.        33.3 MHz       PEAKFLOP TRNSFORM LLL     Linpack Whetstone Savage
  2085.                       MFLOPS   MFLOPS   MFLOPS  MFLOPS  kWhet/sec Func/sec
  2086.        Cyrix 486DLC
  2087.        (cache off) WITH:
  2088.        EM87 emulator  0.0089   0.0082   0.0062  0.0063         31      472 ##
  2089.        Franke387 emu. 0.0402   0.0324   0.0258  0.0240        184     4807 $$
  2090.        TP/MS-FORT emu 0.0346   0.0288   0.0206  0.0212        173     4401 %%
  2091.        Q387 emulator  0.1214   0.0810   0.0368  0.0382        320     6020 ((
  2092.        Intel 387DX    0.8455   0.6552   0.3659  0.3033       2249    48780
  2093.        ULSI 83C87     1.1818   0.7543   0.3752  0.3026       2381    53476
  2094.        IIT 3C87       0.9541   0.6609   0.3653  0.3036       2476    55814
  2095.        IIT 3C87,4X4   0.9541   1.4988   0.3653  0.3036       2476    55814 @@
  2096.        C&T 38700      1.1183   0.7644   0.3796  0.3087       2703    73350
  2097.        Cyrix 387+     1.1305   0.7445   0.3727  0.3060       2731    81967
  2098.        Cyrix EMC87    1.2236   0.7593   0.3823  0.3144       2908    88889 //
  2099.  
  2100.        Intel RapidCAD 1.8572   1.5798   0.6072  0.4533       3953    72464
  2101.        Intel 486DX    2.0800   1.7779   0.9387  0.6682       5143    82192
  2102.  
  2103.  
  2104.  
  2105.        40.0 MHz       PEAKFLOP TRNSFORM LLL     Linpack Whetstone Savage
  2106.                       MFLOPS   MFLOPS   MFLOPS  MFLOPS  kWhet/sec Func/sec
  2107.        Cyrix 486DLC
  2108.        (cache off) WITH:
  2109.        EM87 emulator  0.0107   0.0098   0.0075  0.0075         37      567 ##
  2110.        Franke387 emu. 0.0488   0.0392   0.0311  0.0288        223     5808 $$
  2111.        TP/MS-FORT emu 0.0416   0.0345   0.0246  0.0253        208     5284 %%
  2112.        Q387 emulator  0.1463   0.0973   0.0442  0.0458        384     7237 ((
  2113.        Intel 387DX    1.0196   0.7880   0.4375  0.3644       2712    58479
  2114.        ULSI 83C87     1.4247   0.9064   0.4506  0.3630       2868    64171
  2115.        IIT 3C87       1.1556   0.7963   0.4399  0.3611       2988    66964
  2116.        IIT 3C87,4X4   1.1556   1.7916   0.4399  0.3611       2988    66964 @@
  2117.        C&T 38700      1.3333   0.9210   0.4548  0.3708       3254    88106
  2118.        Cyrix 387+     1.3507   0.8958   0.4477  0.3754       3297    98361
  2119.        Cyrix EMC87    1.4648   0.9136   0.4548  0.3773       3505   106572 //
  2120.  
  2121.        Intel RapidCAD 2.2128   1.8931   0.7377  0.5432       4810    86957
  2122.        Intel 486DX    2.4762   2.1335   1.1110  0.8204       6195    98522
  2123.  
  2124.  
  2125.  
  2126.        33.3 MHz       PEAKFLOP TRNSFORM LLL     Linpack Whetstone Savage
  2127.                       MFLOPS   MFLOPS   MFLOPS  MFLOPS  kWhet/sec Func/sec
  2128.        Cyrix 486DLC
  2129.        (cache on) WITH:
  2130.        EM87 emulator  0.0099   0.0089   0.0068  0.0069         35      550 ##
  2131.        Franke387 emu. 0.0462   0.0362   0.0288  0.0265        205     5445 $$
  2132.        TP/MS-FORT emu 0.0410   0.0330   0.0234  0.0241        198     5339 %%
  2133.        Q387 emulator  0.1344   0.0902   0.0389  0.0403        339     6241 ((
  2134.        Intel 387DX    0.8525   0.6552   0.3941  0.3279       2332    49834
  2135.        ULSI 83C87     1.2093   0.7543   0.4068  0.3270       2478    57197
  2136.        IIT 3C87       0.9720   0.6609   0.3959  0.3295       2579    57252
  2137.        IIT 3C87,4X4   0.9720   1.5087   0.3959  0.3295       2579    57252 @@
  2138.        C&T 38700      1.1305   0.7644   0.4126  0.3343       2839    75949
  2139.        Cyrix 387+     1.1429   0.7445   0.4023  0.3310       2866    85349
  2140.        Cyrix EMC87    1.2381   0.7593   0.4150  0.3412       3051    93897 //
  2141.  
  2142.        Intel RapidCAD 1.8572   1.5798   0.6072  0.4533       3953    72464
  2143.        Intel 486DX    2.0800   1.7779   0.9387  0.6682       5143    82192
  2144.  
  2145.  
  2146.  
  2147.        40.0 MHz       PEAKFLOP TRNSFORM LLL     Linpack Whetstone Savage
  2148.                       MFLOPS   MFLOPS   MFLOPS  MFLOPS  kWhet/sec Func/sec
  2149.        Cyrix 486DLC
  2150.        (cache on) WITH:
  2151.        EM87 emulator  0.0118   0.0107   0.0082  0.0082         42      659 ##
  2152.        Franke387 emu. 0.0565   0.0438   0.0350  0.0313        248     6585 $$
  2153.        TP/MS-FORT emu 0.0491   0.0395   0.0279  0.0296        238     6408 %%
  2154.        Q387 emulator  0.1610   0.1084   0.0470  0.0484        407     7509 ((
  2155.        Intel 387DX    1.0297   0.7880   0.4748  0.3937       2801    59821
  2156.        ULSI 83C87     1.4445   0.9028   0.4891  0.3926       2976    65789
  2157.        IIT 3C87       1.1686   0.7963   0.4734  0.3916       3096    68729
  2158.        IIT 3C87,4X4   1.1686   1.8057   0.4734  0.3916       3096    68729 @@
  2159.        C&T 38700      1.3685   0.9173   0.4958  0.4012       3401    91185
  2160.        Cyrix 387+     1.3867   0.8958   0.4887  0.3962       3448   102564
  2161.        Cyrix EMC87    1.4857   0.9100   0.4959  0.4091       3676   112360 //
  2162.  
  2163.        Intel RapidCAD 2.2128   1.8931   0.7377  0.5432       4810    86957
  2164.        Intel 486DX    2.4762   2.1335   1.1110  0.8204       6195    98522
  2165.  
  2166.  
  2167.  
  2168.  
  2169. Benchmark results using the C&T 38600DX CPU and various coprocessors
  2170. --------------------------------------------------------------------
  2171.  
  2172. The Chips&Technologies 38600DX CPU is marketed as a 100% compatible
  2173. replacement for the Intel 386DX CPU. Unlike AMD's Am386, which uses microcode
  2174. that is identical to the Intel 386DX's, the C&T 38600DX uses microcode
  2175. developed independently by C&T using "clean-room" techniques. C&T even
  2176. included the 386DX's "undocumented" LOADALL386 instruction into the
  2177. instruction set to provide full compatibility with the 386DX. In my tests,
  2178. however, I observed that the 38600DX has severe problems with the CPU-
  2179. coprocessor communication, which causes the floating-point performance to
  2180. drop below that of the Intel 386DX/Intel 387DX for most programs. This
  2181. problem exists with all available 387-compatible coprocessors (ULSI 83C87,
  2182. IIT 3C87, Cyrix EMC87, Cyrix 83D87, Cyrix 387+, C&T 38700, Intel 387DX). A
  2183. net.aquaintance also did tests with the 38600DX and arrived at similar
  2184. results. He contacted C&T and they said that they were aware of the problem.
  2185.  
  2186. Some instructions execute faster on the C&T 38600DX than on the 386DX, giving
  2187. an average speedup of 5-10% for integer applications. C&T also produces a
  2188. 38605DX CPU that includes a 512 byte instruction cache and provides a further
  2189. performance increase. However, the 38605DX needs a bigger socket (144-pin
  2190. PGA) and is therefore *not* pin-compatible with the 386DX. Tests using the
  2191. 38600DX were run at 33.3 MHz, as a 40 MHz version was not available as of 09-
  2192. 17-92 and running the 33 MHz chip version at 40 MHz locked up the machine
  2193. frequently. Unfortunately, tests using the Intel 387DX consistently locked up
  2194. in the TRNSFORM benchmark when run at 33.3 MHz. It ran fine at 20 MHz, and
  2195. the results were scaled to show expected performance at 33.3 MHz.
  2196.  
  2197.  
  2198.        33.3 MHz       PEAKFLOP TRNSFORM LLL     Linpack Whetstone Savage
  2199.                       MFLOPS   MFLOPS   MFLOPS  MFLOPS  kWhet/sec Func/sec
  2200.  
  2201.        C&T 38600DX WITH:
  2202.        Intel 387DX    0.7376   0.5620   0.3337  0.2636       2066    45489
  2203.        ULSI 83C87     0.5226   0.4690   0.3236  0.2654       2087    43228
  2204.        IIT 3C87       0.7879   0.5762   0.3397  0.2674       2263    51195
  2205.        IIT 3C87,4X4   0.7879   0.6181   0.3397  0.2674       2263    51195 @@
  2206.        C&T 38700      0.5977   0.5572   0.3463  0.2681       2338    63966
  2207.        Cyrix 387+     0.5896   0.5508   0.3438  0.2673       2375    66741
  2208.  
  2209.        Intel RapidCAD 1.8572   1.5798   0.6072  0.4533       3953    72464
  2210.        Intel 486      2.0800   1.7779   0.9387  0.6682       5143    82192
  2211.  
  2212.  
  2213.        For comparison:
  2214.  
  2215.                       PEAKFLOP TRNSFORM LLL     Linpack Whetstone Savage
  2216.                       MFLOPS   MFLOPS   MFLOPS  MFLOPS  kWhet/sec Func/sec
  2217.  
  2218.        i486DX2-66     4.1601   3.4227   1.6531  1.3010      10655   163934
  2219.        i486DX2-50     3.0589   2.6665   1.2537  0.9744       7962   123203
  2220.        i387, 20 MHz   0.2253   0.3271   0.1434  0.1171        952    21739 ++
  2221.        i387DX, 20 MHz 0.3567   0.4444   0.1484  0.1161       1034    24155 &&
  2222.        i80287, 5 MHz  0.0281   0.0310   0.0242  0.0222        150     3261 !!
  2223.        i8087,9.54 MHz 0.0636   0.0705   0.0321  0.0219        234     5782 **
  2224.  
  2225.  
  2226.  
  2227. Benchmark notes and footnotes
  2228. -----------------------------
  2229.  
  2230. Hardware configuration for test of 387 coprocessors with C&T 38600DX, Intel
  2231. 386DX, Cyrix 486DLC, and Intel RapidCAD CPUs:
  2232.  
  2233.      System A: Motherboard with Forex chip set, 128 KB CPU Cache, 8 MB RAM
  2234.  
  2235.  
  2236. Hardware configuration for test of 486 FPU (extra fan for 40 MHz operation):
  2237.  
  2238.      System B: Motherboard with SIS chip set, 256 KB CPU Cache, 8 MB RAM
  2239.  
  2240.  
  2241.  ## EM87 V1.2 by Ron Kimball is a public domain coprocessor emulator that
  2242.     loads as a TSR. It uses INT 7 traps emitted by 80286, 80386, or 486SX
  2243.     systems with no coprocessor upon encountering coprocessor instructions
  2244.     to catch coprocessor instructions and emulate them. Whetstone and Savage
  2245.     benchmarks for this test were compiled with the original TP 6.0 library,
  2246.     as EM87 chokes on the 387 specific FSIN and FCOS instructions used in my
  2247.     own library if a 387 is detected. Obviously EM87 identifies itself as a
  2248.     387, but it has no support for 387-specific instructions.
  2249.  
  2250.  $$ Franke387 is a commercial 387 emulator that is also available in a
  2251.     shareware version. For this test, shareware version V2.4 was used.
  2252.     Franke387 unlike many other emulators supports all 387 instructions.
  2253.     It is loaded as a device driver and uses INT 7 to trap coprocessor
  2254.     instructions.
  2255.  
  2256.  (( Q387 is an emulator that is distributed as a shareware program by
  2257.     Quickware of Austin, Texas. As the name implies, this emulator uses
  2258.     386 specific code and supports the full 387 instruction set. The
  2259.     program is about 330 kByte in size and loads completely into extended
  2260.     memory, using absolutely no DOS memory. It is loaded as a TSR and
  2261.     requires an EMM (expanded memory manager) to be present. The emulation
  2262.     uses the INT 7 mechanism. The version of Q387 used was 3.0a.
  2263.  
  2264.  %% These benchmarks were run using the built-in coprocessor emulators of
  2265.     the TP 6.0 (for Savage, LLL, Whetstone, TRNSFORM, PEAKFLOP) and the MS
  2266.     FORTRAN 5.0 (for Linpack) run-time libraries by forcing the libraries
  2267.     into not using a coprocessor by using the environment settings NO87=NC
  2268.     and 87=N.
  2269.  
  2270.  @@ The 3C87 specific F4X4 instruction was used in the vector transformation
  2271.     benchmark.
  2272.  
  2273.  // The EMC87 was used in the 387-compatible mode only. The faster memory-
  2274.     mapped mode was *not* used. Times should therefore be identical to the
  2275.     Cyrix 83D87.
  2276.  
  2277.  ++ Older motherboard with no chip set (discrete logic), no CPU cache, 16 MB
  2278.     RAM
  2279.  
  2280.  && System A, CPU cache disabled via extended set-up, turbo-switch set to
  2281.     half speed (that is, 20 MHz)
  2282.  
  2283.  !! 80386 @ 20 MHz / Intel 80287 @ 5 MHz, no CPU cache, 4 MB RAM due to the
  2284.     fast CPU used here, performance figures are somewhat higher than can be
  2285.     expected for a 80286/287 combination, except for the PEAKFLOP benchmark,
  2286.     which is basically coprocessor limited.
  2287.  
  2288.  ** 8086/8087 system with 640 KB RAM
  2289.  
  2290.  
  2291. Benchmark results for Weitek coprocessors
  2292. ------------------------------------------
  2293. Since neither a Weitek coprocessor nor a compiler that generates code for the
  2294. Weitek chips were available to me, performance data for the Weitek Abacus is
  2295. given here according to [31,32] and scaled to show performance of a 33 MHz
  2296. system. The benchmarks were compiled using highly-optimizing 32-bit
  2297. compilers.
  2298.  
  2299.                               Single Prec.     Double Prec.    Double Prec.
  2300.  
  2301.                               3167    4167     3167    4167      387    486
  2302.  
  2303.          Linpack MFLOPS        1.8     5.0      0.8     3.2      0.4    1.6
  2304.          Whetstone kWhet/sec  7470   22700     4900   14000     3290  12300
  2305.  
  2306. Note that for the Intel coprocessors, running programs in single vs. double-
  2307. precision doesn't provide much of an performance advantage since all internal
  2308. calculations are always done in extended precision. Using Weitek
  2309. coprocessors, however, performance nearly doubles in single-precision mode.
  2310. For double-precision calculations using only basic arithmetic, the Weitek
  2311. Abacus can at most provide performance at twice the level of the respective
  2312. Intel coprocessor (387/486) at the same clock speed.
  2313.  
  2314.  
  2315.          Comparison of floating-point performance [30,32]
  2316.  
  2317.                                       single-precision
  2318.  
  2319.                           Weitek 4167-33    Intel 486-33   Intel 486DX2-66
  2320.  
  2321.          Linpack MFLOPS            5.0           1.8             3.5
  2322.          Whetstones kWhet/sec    22700         12700           25500
  2323.  
  2324.  
  2325.                                       double-precision
  2326.  
  2327.                         Weitek 4167-33  Intel 486-33 Intel 486DX2-66
  2328.  
  2329.          LINPACK MFLOPS            3.5           1.6             3.1
  2330.          kWhetstones/sec         14000         12300           24700
  2331.  
  2332.  
  2333.  
  2334. =============================================================================
  2335. Clock-cycle timings for coprocessor instructions on various coprocessor chips
  2336. =============================================================================
  2337.  
  2338. Speed of various coprocessor instructions, measured in clock cycles, as
  2339. captured by my program 87TIMES. Error is +/- one clock cycle, except for the
  2340. Intel 80287. Times for the 80287 were determined on a system with a 20 MHz
  2341. 80386 and a 5 MHz Intel 80287. Therefore, times may differ from a genuine
  2342. 80286/287 system, especially for those instructions that access an operand in
  2343. memory. Since the times are stated as the number of coprocessor clock cycles
  2344. used, the faster 386 which can execute four clock cycles where the 80287
  2345. executes one clock cycle may decrease memory access times as seen by the
  2346. coprocessor.
  2347.  
  2348. The CPU used in testing the 387 coprocessors was an Intel 386DX. Note that
  2349. due to the improved coprocessor interface of the Cyrix 486DLC the execution
  2350. time of most coprocessor instructions drops by 2-3 clock cycles when used
  2351. with this CPU.
  2352.  
  2353.  
  2354.                   Intel  Intel  Cyrix Cyrix C&T   ULSI  IIT  Intel Intel
  2355.                   i486 RapidCAD 83D87 387+  38700 83C87 3C87 387DX 80387
  2356.  
  2357.              FLD1    4      3     14    14    14    18    24    23    26
  2358.              FLDZ    4      3     14    14    14    18    24    23    31
  2359.             FLDPI    7      8     14    15    14    18    24    38    45
  2360.            FLDLG2    7      8     14    14    14    18    24    33    45
  2361.            FLDL2T    7      8     14    14    14    19    24    38    45
  2362.            FLDL2E    7      8     14    14    14    19    24    38    45
  2363.            FLDLN2    7      8     14    14    14    19    24    38    45
  2364.         FLD ST(0)    4      4     14    14    14    14    24    20    21
  2365.         FST ST(1)    3      4     14    14    14    14    19    18    22
  2366.        FSTP ST(0)    4      4     14    14    14    15    19    19    22
  2367.        FSTP ST(1)    4      4     15    15    14    15    19    20    22
  2368.         FLD ST(1)    4      4     14    14    14    14    24    18    21
  2369.        FXCH ST(1)    4      4     14    20    14    19    24    24    27
  2370.       FILD [Word]   12     16     33    37    32    42    38    47    62
  2371.      FILD [DWord]    8     11     26    26    21    32    28    35    45
  2372.      FILD [QWord]    9     15     30    30    25    36    32    34    54
  2373.       FLD [DWord]    3      5     26    26    21    23    28    20    25
  2374.       FLD [QWord]    3      7     30    30    25    27    32    24    35
  2375.       FLD [TByte]    5     11     46    46    46    46    47    46    57
  2376.      FBLD [TByte]   83     90     66    86   106   146   197    71   278
  2377.       FIST [Word]   31     31     37    40    37    42    51    69    90
  2378.      FIST [DWord]   29     30     35    40    35    40    49    66    84
  2379.       FST [DWord]    7      7     35    37    32    40    33    37    40
  2380.       FST [QWord]    8      9     43    43    39    47    40    45    51
  2381.      FISTP [Word]   32     32     42    40    37    43    46    70    90
  2382.     FISTP [DWord]   31     31     40    40    35    41    50    67    87
  2383.     FISTP [QWord]   29     29     44    44    42    48    56    73    92
  2384.      FSTP [DWord]    8      8     38    36    32    41    35    38    43
  2385.      FSTP [QWord]    9      9     46    43    39    48    42    46    49
  2386.      FSTP [TByte]    8      8     50    45    49    50    48    53    58
  2387.     FBSTP [TByte]  170    172     98    98   114   129   218   144   533
  2388.             FINIT   17     31     15    16    15    15    16    16    25
  2389.             FCLEX    7     20     15    16    16    16    16    16    25
  2390.              FCHS    7      8     14    15    14    14    19    30    33
  2391.              FABS    5      5     14    15    14    14    19    30    33
  2392.              FXAM   12     13     14    15    14    14    19    39    43
  2393.              FTST    5      5     19    25    14    24    24    34    38
  2394.            FSTENV   67     82    125   125   124   132   124   159   165
  2395.            FLDENV   44     59    106   106   112   120   106   119   129
  2396.             FSAVE  181    169    355   355   374   361   376   469   511
  2397.            FRSTOR  130    203    358   358   385   372   371   420   456
  2398.       FSTSW [mem]    4      5     14    14    14    14    14    14    17
  2399.          FSTSW AX    3      4     12    12    11    11    11    11    14
  2400.       FSTCW [mem]    4      5     14    14    13    13    13    14    18
  2401.       FLDCW [mem]    4     11     26    26    31    32    27    32    36
  2402.     FADD ST,ST(0)    8      9     19    20    19    19    24    24    32
  2403.     FADD ST,ST(1)    9      9     19    20    19    18    24    20    32
  2404.     FADD ST(1),ST   10     10     19    20    19    18    24    24    37
  2405.    FADDP ST(1),ST   11     11     19    19    19    16    24    25    37
  2406.      FADD [DWord]    9     10     25    28    22    23    23    21    34
  2407.      FADD [QWord]    9     10     32    32    26    27    27    25    38
  2408.      FIADD [Word]   20     21     34    34    33    40    40    52    80
  2409.     FIADD [DWord]   20     21     27    28    27    30    30    37    61
  2410.     FSUB ST(1),ST   10     10     19    20    19    19    24    24    38
  2411.    FSUBR ST(1),ST    9     10     19    22    19    19    24    27    38
  2412.   FSUBRP ST(1),ST   10     10     19    19    22    20    24    25    38
  2413.      FSUB [DWord]   11     12     27    28    27    23    29    27    32
  2414.      FSUB [QWord]   11     12     32    32    31    27    33    26    44
  2415.      FISUB [Word]   21     21     34    34    34    40    40    52    80
  2416.     FISUB [DWord]   21     22     27    28    27    29    30    40    60
  2417.     FMUL ST,ST(1)   16     17     19    25    24    24    29    38    57
  2418.     FMUL ST(1),ST   16     17     19    24    24    24    29    40    62
  2419.    FMULP ST(1),ST   17     17     19    24    24    25    29    40    58
  2420.      FIMUL [Word]   22     23     40    40    37    46    46    52    80
  2421.     FIMUL [DWord]   22     23     27    28    27    36    35    45    68
  2422.      FMUL [DWord]   11     12     27    28    27    28    29    25    45
  2423.      FMUL [QWord]   14     15     32    32    31    32    33    37    61
  2424.     FDIV ST,ST(0)   73     74     26    40    59    54    54    89   100
  2425.     FDIV ST,ST(1)   73     74     36    45    59    54    54    77   100
  2426.     FDIV ST(1),ST   73     74     36    45    59    55    54    78   102
  2427.    FDIVR ST(1),ST   73     74     36    45    59    54    54    77   102
  2428.   FDIVRP ST(1),ST   73     74     36    44    59    55    54    76   106
  2429.      FIDIV [Word]   84     85     52    58    75    76    76   105   141
  2430.     FIDIV [DWord]   84     85     45    46    65    65    65   101   123
  2431.      FDIV [DWord]   73     74     45    46    63    56    59    77   101
  2432.      FDIV [QWord]   73     74     50    50    67    60    63    78   103
  2433.       FSQRT (0.0)   25     25     19    19    14    19    24    29    37
  2434.       FSQRT (1.0)   83     84     36    74    54    89    59   109   132
  2435.       FSQRT (L2T)   86     87     36    74    54    89    59   104   137
  2436.     FXTRACT (L2T)   17     17     19    19    19    28    79    53    72
  2437.     FSCALE (PI,5)   30     30     36    24    24    49    79    59    82
  2438.      FRNDINT (PI)   31     31     19    29    24    34    29    49    82
  2439.     FPREM (99,PI)   58     59     54    99    44    54    49    79    96
  2440.     FPREM1(99,PI)   90     91     54    99    44    59    54   104   121
  2441.              FCOM    5      6     15    20    19    25    19    29    32
  2442.             FCOMP    6      6     15    19    19    25    19    30    33
  2443.            FCOMPP    7      7     15    19    19    25    19    31    40
  2444.      FICOM [Word]   16     17     34    34    33    46    34    58    76
  2445.     FICOM [DWord]   16     16     21    28    21    35    23    45    57
  2446.      FCOM [DWord]    5      6     21    28    22    23    23    27    34
  2447.      FCOM [QWord]    5      8     27    32    25    27    27    31    39
  2448.        FSIN (0.0)   24     24     14    99    14    19    24    39    43
  2449.        FSIN (1.0)  310    313    114   164   144   494   219   509   596
  2450.         FSIN (PI)   88     89    118   189    64    64   214   134   152
  2451.        FSIN (LG2)  292    295     72    89   139   454   184   449   531
  2452.        FSIN (L2T)  299    302    123   179   164   469   214   454   536
  2453.        FCOS (0.0)   24     24     19   159    14    19    24    34    42
  2454.        FCOS (1.0)  302    305     84   104   139   489   214   459   547
  2455.         FCOS (PI)   88     89    154   254    64    64   224   199   232
  2456.        FCOS (LG2)  300    303    108   149   139   454   194   504   583
  2457.        FCOS (L2T)  307    310    159   239   164   469   224   509   601
  2458.     FSINCOS (0.0)   25     25     14    19    19    18    34    38    55
  2459.     FSINCOS (1.0)  353    356    124   174   254   493   419   538   636
  2460.      FSINCOS (PI)  105    106    162   263    79    68   424   228   277
  2461.     FSINCOS (LG2)  340    343    119   159   249   458   359   533   627
  2462.     FSINCOS (L2T)  347    350    168   248   274   473   424   538   646
  2463.       FPTAN (0.0)   25     25     14    19    19    18    29    38    46
  2464.       FPTAN (1.0)  266    269    119   149   184   538   309   323   396
  2465.        FPTAN (PI)  145    146    134   228   104   108   304   168   211
  2466.       FPTAN (LG2)  244    246     94   129   179   498   274   298   363
  2467.       FPTAN (L2T)  247    249    139   219   204   513   304   298   365
  2468.      FPATAN (0.0)   38     39     19    24    19    20    29    95    93
  2469.      FPATAN (1.0)  294    298    124   159    29   375   604   360   433
  2470.       FPATAN (PI)  304    308    139   188   279   360   424   375   472
  2471.      FPATAN (LG2)  290    293    128   154   269   365   379   375   448
  2472.      FPATAN (L2T)  304    308    144   189   274   359   424   375   468
  2473.       F2XM1 (0.0)   25     25     14    14    14    19    24    34    37
  2474.       F2XM1 (LN2)  209    211     89   119   169   394   284   299   348
  2475.       F2XM1 (LG2)  204    206     78   104   159   379   284   294   337
  2476.       FYL2X (1.0)   60     61     36    39    24    75    94   115   127
  2477.        FYL2X (PI)  294    297    108   163   249   450   359   395   504
  2478.       FYL2X (LG2)  311    314    108   159   249   460   339   410   518
  2479.       FYL2X (L2T)  293    296    108   164   249   439   359   390   501
  2480.     FYL2XP1 (LG2)  334    337     99   169   234   460   284   435   538
  2481.  
  2482.  
  2483.  
  2484.                                   80386 +  80386 +   80386 +  80386 +
  2485.                      Intel Intel  Q387     Franke387 TP 6.0   EM87
  2486.                      8087  80287  Emulator Emulator  Emulator Emulator
  2487.  
  2488.              FLD1    26     55      51      481       422      1626
  2489.              FLDZ    21     53      39      480       416      1646
  2490.             FLDPI    26     55      51      486       443      1626
  2491.            FLDLG2    26     56      51      486       423      1626
  2492.            FLDL2T    26     55      51      486       440      1626
  2493.            FLDL2E    26     53      52      486       423      1626
  2494.            FLDLN2    26     55      52      486       441      1626
  2495.         FLD ST(0)    31     55      57      493       362      1851
  2496.         FST ST(1)    26     54      61      489       355      1931
  2497.        FSTP ST(0)    26     54      46      507       358      2115
  2498.        FSTP ST(1)    21     55      66      507       356      2116
  2499.         FLD ST(1)    26     55      54      493       362      1852
  2500.        FXCH ST(1)    21     57      80      497       486      2187
  2501.       FILD [Word]    58     90     122      667       712      2259
  2502.      FILD [DWord]    64     74     121      608       812      2164
  2503.      FILD [QWord]    74     93     179      652       707      2971
  2504.       FLD [DWord]    49     44     106      633       473      2077
  2505.       FLD [QWord]    54     57     118      641       524      2336
  2506.       FLD [TByte]    59     45     102      607       492      2063
  2507.      FBLD [TByte]   309    310     736     2019      1512     17827
  2508.       FIST [Word]    79     72     143      854       766      2418
  2509.      FIST [DWord]    84     80     136      865       518      2325
  2510.       FST [DWord]    89     85     124      686       441      2200
  2511.       FST [QWord]    99     92     135      703       516      2481
  2512.      FISTP [Word]    79     80     154      864       794      2620
  2513.     FISTP [DWord]    79     81     144      879       541      2523
  2514.     FISTP [QWord]    88     75     184      904       916      3226
  2515.      FSTP [DWord]    89     75     133      713       467      2400
  2516.      FSTP [QWord]    93     72     142      732       538      2678
  2517.      FSTP [TByte]    49     21     111      685       467      2124
  2518.     FBSTP [TByte]   528    472    1124     3305      1555     27013
  2519.             FINIT    11     10    1079      742       641      1369
  2520.             FCLEX    11     10      48      440       323       912
  2521.              FCHS    21     54      45      460       354      1744
  2522.              FABS    21     54      43      456       349      1738
  2523.              FXAM    21     54      72      481       380      1551
  2524.              FTST    51     75      70      585       386      2721
  2525.            FSTENV    54     57     827      928       519      2104
  2526.            FLDENV    48     50     780     1125       450      1631
  2527.             FSAVE   214    244    3929     1949       976      2749
  2528.            FRSTOR   209    227    2901     2182       657      2225
  2529.       FSTSW [mem]    28     10      87      516       401      1189
  2530.          FSTSW AX   N/A     55      57      451       N/A       N/A
  2531.       FSTCW [mem]    28     10      74      506       359      1167
  2532.       FLDCW [mem]    19     47      91      524       437      1584
  2533.     FADD ST,ST(0)    86    128     136      643       706      2805
  2534.     FADD ST,ST(1)    85    116     146      707       808      3093
  2535.     FADD ST(1),ST    92    131     157      664       812      3146
  2536.    FADDP ST(1),ST    92    129     164      704       799      3143
  2537.      FADD [DWord]   105    122     221      874       969      3139
  2538.      FADD [QWord]   115    122     232      888      1021      3396
  2539.      FIADD [Word]   115    122     238      940      1211      3330
  2540.     FIADD [DWord]   125    122     239      882      1297      3215
  2541.     FSUB ST(1),ST    88    130     171      738       817      3156
  2542.    FSUBR ST(1),ST    96    132     181      740       868      3004
  2543.   FSUBRP ST(1),ST    99    132     193      733       805      3301
  2544.      FSUB [DWord]   119    122     230      918      1018      3127
  2545.      FSUB [QWord]   129    123     242      932      1070      3632
  2546.      FISUB [Word]   115    123     268      977      1081      3802
  2547.     FISUB [DWord]   125    125     289      940       980      4161
  2548.     FMUL ST,ST(1)   145    151     297      810      1368      3924
  2549.     FMUL ST(1),ST   145    151     296      817      1377      3962
  2550.    FMULP ST(1),ST   148    168     304      840      1365      4164
  2551.      FIMUL [Word]   132    151     384     1039      1517      4039
  2552.     FIMUL [DWord]   141    151     383      980      1643      3976
  2553.      FMUL [DWord]   125    123     345      948      1480      3445
  2554.      FMUL [QWord]   175    192     387      991      1602      4416
  2555.     FDIV ST,ST(0)   201    207     274      726      1536      9789
  2556.     FDIV ST,ST(1)   203    218     299      808      1658     10332
  2557.     FDIV ST(1),ST   207    214     299      825      1655     10342
  2558.    FDIVR ST(1),ST   201    206     302      819      1806     10213
  2559.   FDIVRP ST(1),ST   201    205     309      845      1803     10409
  2560.      FIDIV [Word]   237    227     390      980      1779     11225
  2561.     FIDIV [DWord]   246    227     411      944      1680     11572
  2562.      FDIV [DWord]   229    226     352      893      1722     10577
  2563.      FDIV [QWord]   236    227     391      993      1777     10829
  2564.       FSQRT (0.0)    21     57      60      512       382      1755
  2565.       FSQRT (1.0)   186    206     294     1106      2504     37836
  2566.       FSQRT (L2T)   186    207     295     1398      2467     37925
  2567.     FXTRACT (L2T)    51     56     155      726       571      3326
  2568.     FSCALE (PI,5)    41     56      95      817       443      3194
  2569.      FRNDINT (PI)    51     58     136      808       800      7092
  2570.     FPREM (99,PI)    81    131     322     1696       941      4098
  2571.     FPREM1(99,PI)   N/A    N/A     384     1625       N/A       N/A
  2572.              FCOM    56     75     155      582       483      2799
  2573.             FCOMP    61     92     160      616       485      2983
  2574.            FCOMPP    61     90     149      661       476      3198
  2575.      FICOM [Word]    79     77     231      808       861      3654
  2576.     FICOM [DWord]    89     77     231      750       964      3684
  2577.      FCOM [DWord]    74     75     214      741       625      3643
  2578.      FCOM [QWord]    74     76     205      754       667      3771
  2579.        FSIN (0.0)   N/A    N/A     137      639       N/A       N/A
  2580.        FSIN (1.0)   N/A    N/A     997     4640       N/A       N/A
  2581.         FSIN (PI)   N/A    N/A     322     2488       N/A       N/A
  2582.        FSIN (LG2)   N/A    N/A     978     3911       N/A       N/A
  2583.        FSIN (L2T)   N/A    N/A    1005     3767       N/A       N/A
  2584.        FCOS (0.0)   N/A    N/A     182      740       N/A       N/A
  2585.        FCOS (1.0)   N/A    N/A     988     4777       N/A       N/A
  2586.         FCOS (PI)   N/A    N/A     337     2557       N/A       N/A
  2587.        FCOS (LG2)   N/A    N/A     976     4176       N/A       N/A
  2588.        FCOS (L2T)   N/A    N/A    1001     3905       N/A       N/A
  2589.     FSINCOS (0.0)   N/A    N/A     225      714       N/A       N/A
  2590.     FSINCOS (1.0)   N/A    N/A    1841     6049       N/A       N/A
  2591.      FSINCOS (PI)   N/A    N/A    1167     4091       N/A       N/A
  2592.     FSINCOS (LG2)   N/A    N/A    1525     5640       N/A       N/A
  2593.     FSINCOS (L2T)   N/A    N/A    1552     5405       N/A       N/A
  2594.       FPTAN (0.0)    41     58      90      752      8381      2324
  2595.       FPTAN (1.0)   581    582    1182     6366     10817     29824
  2596.        FPTAN (PI)   606    587     292     4388     12410      2300
  2597.       FPTAN (LG2)   516    513     883     5939     12502     26770
  2598.       FPTAN (L2T)   576    586     954     5723     12483      2301
  2599.      FPATAN (0.0)    41     55     123      616      1208     10578
  2600.      FPATAN (1.0)   736    736     171     1426     13446     34208
  2601.       FPATAN (PI)   206    207   11115     2835     13305     46903
  2602.      FPATAN (LG2)   756    736   11077     2490     13319     41312
  2603.      FPATAN (L2T)   206    204   11117     2922     13364     50149
  2604.       F2XM1 (0.0)    16     56     102      563       723      1722
  2605.       F2XM1 (LN2)   631    624     905     4178     11070     33823
  2606.       F2XM1 (LG2)   611    585     890     4798     11116     32163
  2607.       FYL2X (1.0)    56     57     136      961      1214      4327
  2608.        FYL2X (PI)   946    961    1008     8987     12858     40148
  2609.       FYL2X (LG2)  1081   1038    1035     8933     12748     46821
  2610.       FYL2X (L2T)   926    886    1089     8982     12712     38986
  2611.     FYL2XP1 (LG2)  1026   1037    1154    10485     11867     44708
  2612.  
  2613.  
  2614. Clock-cycle timings for floating-point operations on Weitek coprocessors
  2615. ------------------------------------------------------------------------
  2616.  
  2617. The Weitek 3167 and 4167 coprocessors only implement the basic arithmetic
  2618. functions (add, subtract, multiply, divide, square root) in hardware;
  2619. transcendental functions are implemented by means of a software library
  2620. supplied by Weitek which uses the basic hardware instructions to approximate
  2621. the transcendental functions (using polynomial and rational approximations).
  2622. The clock cycle timings for the transcendental functions are average values,
  2623. since execution time can differ with the value of argument. The speed of
  2624. transcendental functions for the 4167 is estimated based on the numbers in
  2625. [31,33], from which this timing information has been extracted.
  2626.  
  2627.  
  2628.                   Single-precision         Double-precision
  2629.  
  2630.                   3167       4167          3167        4167
  2631.  
  2632.          ABS         3          2             3           2
  2633.          NEG         6          2             6           2
  2634.          ADD         6          2             6           2
  2635.          SUB         6          2             6           2
  2636.          SUBR        6          2             6           2
  2637.          MUL         6          2            10           3
  2638.          DIVR       38         17            66          31
  2639.          SQRT       60         17           118          31
  2640.          SIN       146        ~50           292        ~100
  2641.          COS       140        ~50           285        ~100
  2642.          TAN       188        ~60           340        ~110
  2643.          EXP       179        ~60           401        ~130
  2644.          LOG       171        ~60           365        ~120
  2645.          F->ASCII 1000        N/A          1700         N/A  //
  2646.          ASCII->F 1100        N/A          1800         N/A  //
  2647.  
  2648.          // rough average of the timings given for different numeric
  2649.             formats by Weitek. Note that these conversions routines
  2650.             do much more work than the FBLD and FBSTP instructions
  2651.             provided by the 80x87 coprocessors. FBLD and FBSTP are
  2652.             useful for conversion routines but quite a bit of additional
  2653.             code is need for this purpose.
  2654.  
  2655.  
  2656.  
  2657. =============================================================================
  2658. Accuracy of calculations performed by a coprocessor / The IEEETEST program
  2659. =============================================================================
  2660.  
  2661. Among the 80x87 coprocessors, the IEEE-754 Standard for Binary Floating-Point
  2662. Arithmetic [10,11] was first fully implemented by Intel's 387 coprocessor [17].
  2663. Among other things, this means that the add, subtract, multiply, divide,
  2664. remainder, and square root operations always deliver the 'exact' result. By
  2665. 'exact', the standard means that the coprocessor always delivers the machine
  2666. number closest to the real result, which may not always be representable
  2667. exactly in the available numeric format. The 80387 implements the single,
  2668. double, and double extended formats as specified in the IEEE standard, as
  2669. well as all functions required by it [17].
  2670.  
  2671. Note that earlier Intel coprocessors (the 8087 and the 80287) comply with a
  2672. draft version of the standard that differs from the final version. These
  2673. chips were developed before IEEE-754 was finally accepted in 1985. As with
  2674. the 80387, the basic arithmetic in the 8087 and the 80287 is 'exact' in the
  2675. sense that the computed result is always the machine number closest to the
  2676. real result. However, there are some differences regarding certain operands
  2677. like infinities, and some operations like the remainder are defined
  2678. differently than in the final version of the standard.
  2679.  
  2680. Some new instructions were introduced with the 80387, most notably the FSIN
  2681. and FCOS operations. The argument range for some transcendental function has
  2682. also been extended [17]. Note that the IEEE-754 standard says nothing about
  2683. the quality of the implementation of transcendental functions like sin, cos,
  2684. tan, arctan, log. Intel uses a modified CORDIC [18,19] technique to compute
  2685. the transcendental functions; Intel claims that maximum error in the 8087,
  2686. 80287, and 80387 for all transcendental functions does not exceed two bits in
  2687. the mantissa of the double extended format, which features 64 mantissa bits
  2688. for an overall accuracy of approximately 19 decimal places [22,23]. This
  2689. claim has been independently verified by a competing vendor [13]. This means
  2690. that at least 62 of the 64 mantissa bits returned as a result by one of the
  2691. transcendental function instructions are guaranteed to be correct.
  2692.  
  2693. The Weitek Abacus 3167 and 4167 coprocessors are 'mostly compatible' with
  2694. IEEE-754 [31,32,33]. They support the single-precision and double precision
  2695. numeric formats described in the standard, as well as the four rounding modes
  2696. required by it. However, due to Weitek's desire for extremely high-speed
  2697. operation, some of the finer points of IEEE-754 have not been implemented.
  2698. One of the most notable omissions is the missing support for denormal
  2699. numbers; denormals are always flushed to zero on Weitek chips.
  2700.  
  2701. The 387 clone manufacturers all claim 100% compatibility with Intel's 80387,
  2702. so one would reasonably expect the same accuracy from their chips as from
  2703. Intel's. For example, on the packaging of the IIT 3C87 it states that "...the
  2704. requirements of ANSI/IEEE standards are fulfilled and exceeded". Cyrix states
  2705. that their 83D87 complies fully with the IEEE-754 standard [12], and in fact
  2706. delivers with their coprocessors diagnostic software that includes the
  2707. program IEEETEST. This program is based on the IEEE test vectors from the PhD
  2708. thesis of Dr. Jerome T. Coonen [9]. A test using the IEEE test vectors has
  2709. also been included into the RUNDIAG program on the Intel RapidCAD diagnostic
  2710. disk. Rather than performing random tests, the test vectors check specific
  2711. cases that may be hard to get right. Each test vector specifies the operation
  2712. to be performed, the operands, precision and rounding mode to be used, and
  2713. the result (including flags set) to be expected according to the IEEE-754
  2714. standard.
  2715.  
  2716. I ran IEEETEST on all the available coprocessors/FPUs. The Intel 486, Intel
  2717. RapidCAD, Intel 387, Intel 387DX, Cyrix 83D87, and the Cyrix 387+ passed with
  2718. no errors. The ULSI 83C87 showed some minor flaws in the FCOM, FDIV, FMUL,
  2719. and FSCALE operations, getting flag errors in about 1% of the tested cases,
  2720. but no computational errors. However, for the IIT 3C87, the IEEETEST program
  2721. showed flag *and* some computational errors (that is, wrong results) for all
  2722. tested operations except FXTRACT and FCHS. The Intel 8087 and 80287 show
  2723. numerous errors, but this it not surprising, since they do not comply with
  2724. IEEE-754 but with an earlier draft of that standard, so they do some things
  2725. differently than required by the final version of the standard. In particular
  2726. the Intel 8087/80287 do not feature the IEEE-754 compliant comparison (FUCOM)
  2727. and remainder (FPREM1) instructions available on the Intel 80387 and newer
  2728. coprocessors, so IEEETEST uses the non-compliant FCOM and FPREM instructions
  2729. on these processors. Lack of an IEEE-754 compliant comparison instruction also
  2730. causes a good deal of the errors in the 'Next After' test.
  2731.  
  2732. Since IEEETEST is written in Turbo Pascal, it was recompiled with the $E+
  2733. switch to enable use of the coprocessor emulator built into the TP 6.0 library.
  2734. Using the emulator, IEEETEST aborted in the following tests with a division
  2735. by zero error: 'Comparison', 'Division', 'Next After'. These tests were removed
  2736. from the suite and the remaining tests were performed. The public domain
  2737. emulator EM87 could be tested, but hung in the last test which checks the
  2738. implementation of the remainder operation. This problem occurred because EM87
  2739. incorrectly identifies itself as an 387 type coprocessor when run on an 80386.
  2740. This causes the 387 specific FUCOM instruction to be used in the 'Comparison'
  2741. and 'Next After' tests and the FPREM1 instruction to be used in the 'Remainder'
  2742. test. Apparently EM87 is not able to emulate these instructions and therefore
  2743. crashes upon trying to execute them. It is interesting to note how the error
  2744. profile of EM87 matches exactly that of the Intel 80287, so it can be assumed
  2745. that EM87 is a very good emulation of the 80287 when run on the 80286. The
  2746. Franke387 V2.4 emulator hangs in the following test performed by IEEETEST:
  2747. 'Division', 'Multiplication', 'Scalb', 'Remainder'. The cause for these
  2748. failures is unknown.
  2749.  
  2750.  
  2751. This explanatory text is printed at the start of the IEEETEST program:
  2752.  
  2753.      JT Coonen's 1984 UC Berkeley Ph.D. thesis centers around his activities
  2754.      as a member of the floating-point working group that defined the IEEE
  2755.      754-1985 Standard for Binary Floating-Point Arithmetic. Appendix C of
  2756.      his thesis presents FPTEST, a Pascal program written by J Thomas and JT
  2757.      Coonen. IEEETEST is a port of FPTEST and runs on PCs whose math
  2758.      coprocessor accepts 80387-compatible floating-point instructions.
  2759.  
  2760.      IEEETEST reads test vectors from the file TESTVECS and compares the
  2761.      answer returned by the math coprocessor with the answer listed in the
  2762.      test vector. If these answers differ an 'F' is displayed, otherwise a
  2763.      '.'is displayed. Answers can differ due to two types of failures:
  2764.      numeric failures or flag failures. Numeric failures occur when the
  2765.      computed answer has the wrong value. Flag failures occur when the status
  2766.      (invalid operation, divide by zero, underflow, overflow, inexact) is
  2767.      incorrectly identified.
  2768.  
  2769.      TESTVECS is the concatenation of unmodified versions of all the test
  2770.      vectors distributed by UC Berkeley. The test data base is copyrighted by
  2771.      UC Berkeley (1985) and is being distributed with their permission.
  2772.      FPTEST and the test data base can be obtained by asking for 'IEEE-754
  2773.      Test Vector' from UC Berkeley, Electrical Engineering and Computer
  2774.      Science, Industrial Liaison Program, 479 Corey Hall, Berkeley, CA, 94720
  2775.      (415)643-6687.
  2776.  
  2777.      The initial version of this test data base for the proposed IEEE 754
  2778.      binary floating-point standard (draft 8.0) was developed for Zilog, Inc.
  2779.      and was donated to the floating-point working group for dissemination.
  2780.      Errors in or additions to the distributed data base should be reported
  2781.      to the agency of distribution, with copies to Zilog, Inc., 1315 Dell
  2782.      Avenue, Campbell, CA, 95008.
  2783.  
  2784.  
  2785. IEEETEST output for Intel 80387, Intel 387DX (manufactured 91/49), Intel 486,
  2786. C&T 38700 (manufactured 92/19), Cyrix 83D87, Cyrix 387+ (manufactured 92/11),
  2787. and Intel RapidCAD (manufactured 92/05):
  2788. ----------------------------------------------------------------------------
  2789.  
  2790.      IEEE-754 Test Vector  Precisions: S=Single D=Double E=Double Extended
  2791.                            |     TESTS     | numeric TYPE OF FAILURE flag
  2792.             Operation Code | Passed Failed |    S    D    E |   S    D    E
  2793.      ----------------------------------------------------------------------
  2794.        Absolute Value    A |    216      0 |    0    0    0 |   0    0    0
  2795.              Addition    + |   3528      0 |    0    0    0 |   0    0    0
  2796.            Comparison    C |   4320      0 |    0    0    0 |   0    0    0
  2797.             Copy Sign    @ |   1488      0 |    0    0    0 |   0    0    0
  2798.              Division    / |   4311      0 |    0    0    0 |   0    0    0
  2799.         Fraction Part    F |    624      0 |    0    0    0 |   0    0    0
  2800.                  Logb    L |    960      0 |    0    0    0 |   0    0    0
  2801.        Multiplication    * |   3978      0 |    0    0    0 |   0    0    0
  2802.              Negation    - |    216      0 |    0    0    0 |   0    0    0
  2803.            Next After    N |   2832      0 |    0    0    0 |   0    0    0
  2804.      Round to Integer    I |    558      0 |    0    0    0 |   0    0    0
  2805.                 Scalb    S |    948      0 |    0    0    0 |   0    0    0
  2806.           Square Root    V |    744      0 |    0    0    0 |   0    0    0
  2807.           Subtraction    - |   3528      0 |    0    0    0 |   0    0    0
  2808.             Remainder    % |   2984      0 |    0    0    0 |   0    0    0
  2809.                     Totals |  31235      0 |
  2810.  
  2811.  
  2812. IEEETEST output for ULSI 83C87 (manufactured 91/48):
  2813. ----------------------------------------------------
  2814.  
  2815.      IEEE-754 Test Vector  Precisions: S=Single D=Double E=Double Extended
  2816.                            |     TESTS     | numeric TYPE OF FAILURE flag
  2817.             Operation Code | Passed Failed |    S    D    E |   S    D    E
  2818.      ----------------------------------------------------------------------
  2819.        Absolute Value    A |    216      0 |    0    0    0 |   0    0    0
  2820.              Addition    + |   3528      0 |    0    0    0 |   0    0    0
  2821.            Comparison    C |   4312      8 |    0    0    0 |   0    0    8
  2822.             Copy Sign    @ |   1488      0 |    0    0    0 |   0    0    0
  2823.              Division    / |   4250     61 |    0    0    0 |  28   28    5
  2824.         Fraction Part    F |    624      0 |    0    0    0 |   0    0    0
  2825.                  Logb    L |    960      0 |    0    0    0 |   0    0    0
  2826.        Multiplication    * |   3936     42 |    0    0    0 |  19   19    4
  2827.              Negation    - |    216      0 |    0    0    0 |   0    0    0
  2828.            Next After    N |   2828      4 |    0    0    0 |   0    0    4
  2829.      Round to Integer    I |    558      0 |    0    0    0 |   0    0    0
  2830.                 Scalb    S |    930     18 |    0    0    0 |   6    6    6
  2831.           Square Root    V |    744      0 |    0    0    0 |   0    0    0
  2832.           Subtraction    - |   3528      0 |    0    0    0 |   0    0    0
  2833.             Remainder    % |   2984      0 |    0    0    0 |   0    0    0
  2834.                     Totals |  31102    133 |
  2835.  
  2836.  
  2837. IEEETEST output for ULSI 83S87 (manufactured 92/17)
  2838. (data kindly supplied by Bengt Ask, f89ba@efd.lth.se):
  2839. ------------------------------------------------------
  2840.  
  2841.      IEEE-754 Test Vector  Precisions: S=Single D=Double E=Double Extended
  2842.                            |     TESTS     | numeric TYPE OF FAILURE flag
  2843.             Operation Code | Passed Failed |    S    D    E |   S    D    E
  2844.      ----------------------------------------------------------------------
  2845.        Absolute Value    A |    216      0 |    0    0    0 |   0    0    0
  2846.              Addition    + |   3528      0 |    0    0    0 |   0    0    0
  2847.            Comparison    C |   4320      0 |    0    0    0 |   0    0    0
  2848.             Copy Sign    @ |   1488      0 |    0    0    0 |   0    0    0
  2849.              Division    / |   4296     15 |    0    0    0 |   5    5    5
  2850.         Fraction Part    F |    624      0 |    0    0    0 |   0    0    0
  2851.                  Logb    L |    960      0 |    0    0    0 |   0    0    0
  2852.        Multiplication    * |   3966     12 |    0    0    0 |   4    4    4
  2853.              Negation    - |    216      0 |    0    0    0 |   0    0    0
  2854.            Next After    N |   2828      4 |    0    0    0 |   0    0    4
  2855.      Round to Integer    I |    558      0 |    0    0    0 |   0    0    0
  2856.                 Scalb    S |    930     18 |    0    0    0 |   6    6    6
  2857.           Square Root    V |    744      0 |    0    0    0 |   0    0    0
  2858.           Subtraction    - |   3528      0 |    0    0    0 |   0    0    0
  2859.             Remainder    % |   2984      0 |    0    0    0 |   0    0    0
  2860.                     Totals |  31102     45 |
  2861.  
  2862.  
  2863. IEEETEST output for IIT 3C87 (manufactured 92/20):
  2864. --------------------------------------------------
  2865.  
  2866.      IEEE-754 Test Vector  Precisions: S=Single D=Double E=Double Extended
  2867.                            |     TESTS     | numeric TYPE OF FAILURE flag
  2868.             Operation Code | Passed Failed |    S    D    E |   S    D    E
  2869.      ----------------------------------------------------------------------
  2870.        Absolute Value    A |    200     16 |    0    0   16 |   0    0    0
  2871.              Addition    + |   3336    192 |    0    0  128 |   0    0   96
  2872.            Comparison    C |   4224     96 |    0    0   96 |   0    0    0
  2873.             Copy Sign    @ |   1488      0 |    0    0    0 |   0    0    0
  2874.              Division    / |   4159    152 |    0    0  124 |   0    0  116
  2875.         Fraction Part    F |    600     24 |    0    0   24 |   0    0   24
  2876.                  Logb    L |    960      0 |    0    0    0 |   0    0    0
  2877.        Multiplication    * |   3702    276 |    0    0  248 |   0    0  100
  2878.              Negation    - |    200     16 |    0    0   16 |   0    0    0
  2879.            Next After    N |   2248    584 |    0    0  584 |   0    0  168
  2880.      Round to Integer    I |    542     16 |    0    0    4 |   0    0   16
  2881.                 Scalb    S |    874     74 |    5    5   44 |   8    8   20
  2882.           Square Root    V |    688     56 |    0    0   56 |   0    0   56
  2883.           Subtraction    - |   3336    192 |    0    0  128 |   0    0   96
  2884.             Remainder    % |   2844    140 |    0    0  140 |   0    0  116
  2885.                     Totals |  29401   1834 |
  2886.  
  2887.  
  2888. IEEETEST output for Intel 80287 run with a 80386 CPU and Intel 8087:
  2889. --------------------------------------------------------------------
  2890.  
  2891.      IEEE-754 Test Vector  Precisions: S=Single D=Double E=Double Extended
  2892.                            |     TESTS     | numeric TYPE OF FAILURE flag
  2893.             Operation Code | Passed Failed |    S    D    E |   S    D    E
  2894.      ----------------------------------------------------------------------
  2895.        Absolute Value    A |    216      0 |    0    0    0 |   0    0    0
  2896.              Addition    + |   2886    642 |   16   16  112 | 174  174  174
  2897.            Comparison    C |   3612    708 |  136  136  136 | 228  228  228
  2898.             Copy Sign    @ |   1488      0 |    0    0    0 |   0    0    0
  2899.              Division    / |   3777    534 |   18   18   37 | 169  169  165
  2900.         Fraction Part    F |    552     72 |   24   24   24 |  24   24   24
  2901.                  Logb    L |    900     60 |   12   12   12 |  20   20   20
  2902.        Multiplication    * |   2944   1034 |  105  105  197 | 303  303  231
  2903.              Negation    - |    216      0 |    0    0    0 |   0    0    0
  2904.            Next After    N |    516   2316 |  168  168  332 | 764  764  764
  2905.      Round to Integer    I |    546     12 |    0    0    0 |   4    4    4
  2906.                 Scalb    S |    663    285 |   45   43   26 | 102   98   46
  2907.           Square Root    V |    720     24 |    4    4    4 |   8    8    8
  2908.           Subtraction    - |   2886    642 |   16   16  112 | 174  174  174
  2909.             Remainder    % |   1490   1494 |  432  432  288 | 342  342  230
  2910.                     Totals |  23412   7823 |
  2911.  
  2912.  
  2913. IEEETEST output for EM87 coprocessor emulator run on an Intel 386 CPU:
  2914. ----------------------------------------------------------------------
  2915.  
  2916.      IEEE-754 Test Vector  Precisions: S=Single D=Double E=Double Extended
  2917.                            |     TESTS     | numeric TYPE OF FAILURE flag
  2918.             Operation Code | Passed Failed |    S    D    E |   S    D    E
  2919.      ----------------------------------------------------------------------
  2920.        Absolute Value    A |    216      0 |    0    0    0 |   0    0    0
  2921.              Addition    + |   2886    642 |   16   16  112 | 174  174  174
  2922.            Comparison    C |      0   4320 | 1324 1324 1324 |1332 1332 1332
  2923.             Copy Sign    @ |   1488      0 |    0    0    0 |   0    0    0
  2924.              Division    / |   3777    534 |   18   18   37 | 169  169  165
  2925.         Fraction Part    F |    552     72 |   24   24   24 |  24   24   24
  2926.                  Logb    L |    900     60 |   12   12   12 |  20   20   20
  2927.        Multiplication    * |   2944   1034 |  105  105  197 | 303  303  231
  2928.              Negation    - |    216      0 |    0    0    0 |   0    0    0
  2929.            Next After    N |    348   2484 |  768  768  768 | 504  504  526
  2930.      Round to Integer    I |    546     12 |    0    0    0 |   4    4    4
  2931.                 Scalb    S |    663    285 |   45   43   26 | 102   98   46
  2932.           Square Root    V |    720     24 |    4    4    4 |   8    8    8
  2933.           Subtraction    - |   2886    642 |   16   16  112 | 174  174  174
  2934.             Remainder    % |   ######## not run since machine hangs #######
  2935.  
  2936.  
  2937. IEEETEST output for Franke387 coprocessor emulator run on an Intel 386:
  2938. -----------------------------------------------------------------------
  2939.  
  2940.      IEEE-754 Test Vector  Precisions: S=Single D=Double E=Double Extended
  2941.                            |     TESTS     | numeric TYPE OF FAILURE flag
  2942.             Operation Code | Passed Failed |    S    D    E |   S    D    E
  2943.      ----------------------------------------------------------------------
  2944.        Absolute Value    A |    152     64 |    0    0    8 |  24   24    8
  2945.              Addition    + |   1587   1941 |  178  178  722 | 508  508  616
  2946.            Comparison    C |   3696    624 |  208  208  208 |   4    4  108
  2947.             Copy Sign    @ |   1200    288 |    0    0    0 | 144  144    0
  2948.              Division    / |   ######## not run since machine hangs #######
  2949.         Fraction Part    F |    624      0 |    0    0    0 |   0    0    0
  2950.                  Logb    L |    908     52 |    0    0   16 |  16   16    4
  2951.        Multiplication    * |   ######## not run since machine hangs #######
  2952.              Negation    - |    152     64 |    0    0    8 |  24   24    8
  2953.            Next After    N |   1404   1420 |  404  404  596 |  80   80  172
  2954.      Round to Integer    I |    514     44 |    4    4   20 |   8    8   16
  2955.                 Scalb    S |   ######## not run since machine hangs #######
  2956.           Square Root    V |    569    175 |   14   31   54 |  28   48   72
  2957.           Subtraction    - |   1827   1701 |   98   98  642 | 452  452  576
  2958.             Remainder    % |   ######## not run since machine hangs #######
  2959.  
  2960.  
  2961. IEEETEST output for Q387 coprocessor emulator run on an Intel 386:
  2962. ------------------------------------------------------------------
  2963.  
  2964.      IEEE-754 Test Vector  Precisions: S=Single D=Double E=Double Extended
  2965.                            |     TESTS     | numeric TYPE OF FAILURE flag
  2966.             Operation Code | Passed Failed |    S    D    E |   S    D    E
  2967.      ----------------------------------------------------------------------
  2968.        Absolute Value    A |    104    112 |   42   38   16 |  24   24    0
  2969.              Addition    + |    911   2617 |  746  637  637 | 672  672  380
  2970.            Comparison    C |   3180   1140 |  380  380  380 | 108  108  108
  2971.             Copy Sign    @ |    696    792 |  320  280    0 | 288  288    0
  2972.              Division    / |    900   3411 |  673  574  814 | 977  977  821
  2973.         Fraction Part    F |    348    276 |  154   82   40 |  24   24   24
  2974.                  Logb    L |    656    304 |  136  100   36 |  24   24   12
  2975.        Multiplication    * |   1023   2955 |  759  663  857 | 670  670  442
  2976.              Negation    - |     86    130 |   44   38   32 |  24   24    0
  2977.            Next After    N |    464   2368 |  780  780  796 | 344  344  320
  2978.      Round to Integer    I |    273    285 |   95   74   52 |  72   72   68
  2979.                 Scalb    S |    254    694 |  217  192  137 | 176  168  136
  2980.           Square Root    V |    128    616 |  192  180  147 | 196  196  188
  2981.           Subtraction    - |    911   2617 |  746  637  637 | 672  672  372
  2982.             Remainder    % |    558   2426 |  903  859  664 | 508  508  220
  2983.                     Totals |  10492  20743 |
  2984.  
  2985.  
  2986. IEEETEST output for TP 6.0 coprocessor emulator:
  2987. ------------------------------------------------
  2988.  
  2989.      IEEE-754 Test Vector  Precisions: S=Single D=Double E=Double Extended
  2990.                            |     TESTS     | numeric TYPE OF FAILURE flag
  2991.             Operation Code | Passed Failed |    S    D    E |   S    D    E
  2992.      ----------------------------------------------------------------------
  2993.        Absolute Value    A |    168     48 |   16   16   16 |  16    8    0
  2994.              Addition    + |   1877   1651 |  294  290  336 | 496  456  416
  2995.            Comparison    C |   ## not run - program aborts with div-by-0 ##
  2996.             Copy Sign    @ |   1392     96 |   48   48    0 |  48    0    0
  2997.              Division    / |   ## not run - program aborts with div-by-0 ##
  2998.         Fraction Part    F |    588     36 |   12    0   24 |   0    0    0
  2999.                  Logb    L |    888     72 |   24   24   24 |  12   12   12
  3000.        Multiplication    * |   2148   1830 |  332  310  528 | 520  360  352
  3001.              Negation    - |    160     48 |   16   16   16 |  16    8    0
  3002.            Next After    N |   ## not run - program aborts with div-by-0 ##
  3003.      Round to Integer    I |    318    240 |    0    0    4 |  80   80   80
  3004.                 Scalb    S |    564    384 |  108  100   76 | 112   88   56
  3005.           Square Root    V |    180    564 |  143  157  169 |  72   72  128
  3006.           Subtraction    - |   1877   1651 |  294  290  336 | 496  456  416
  3007.             Remainder    % |   1072   1912 |  652  672  524 | 336  288  216
  3008.  
  3009.  
  3010.  
  3011.  
  3012. Additional accuracy and compatibility tests
  3013. -------------------------------------------
  3014.  
  3015. To complement the checks done by IEEETEST, I also wrote the short programs
  3016. DENORMTS, RCTRL, PCTRL in Turbo Pascal 6.0 that test the following
  3017. coprocessor functions:
  3018.  
  3019.     1. support for denormals in all precisions (single, double, extended)
  3020.     2. support for the four IEEE rounding modes (up, down, nearest, chop)
  3021.     3. support for precision control
  3022.  
  3023. Note that passing all tests is required for IEEE conformance, as well as 100%
  3024. compatibility with Intel's coprocessors. Precision control forces the results
  3025. of the FADD, FSUB, FMUL, FDIV, and FSQRT instruction to be rounded to the
  3026. specified precision (single, double, double extended). This feature is
  3027. provided to obtain compatibility with certain programming languages [17]. By
  3028. specifying lower precision, one effectively nullifies the advantages of
  3029. extended precision intermediate results.
  3030.  
  3031. The IEEE-754 standard for floating-point arithmetic demands that processors
  3032. and floating-point packages that can not store the result of operations
  3033. *directly* to single and double precision location must provide precision
  3034. control. The programs that test precision control and rounding control are
  3035. designed to return a different result for each of the modes for the same
  3036. sequence of operation.
  3037.  
  3038. The source code of the programs can be found in appendix A. The Intel 8087
  3039. and 80287 were not tested with DENORMTS since Turbo Pascal does not support
  3040. extended precision denormals on 8087/80287 processors, so the denormal test
  3041. fails anyway. (The 8087 and 287 pass the RCTRL and PCTRL tests without error,
  3042. however).
  3043.  
  3044.  
  3045. Test Results for the Intel 387, Intel 387DX, Intel 486, Intel RapidCAD,
  3046. Cyrix 83D87, Cyrix 387+, C&T 38700, and the EM87 emulator (on an 80386 system):
  3047. -------------------------------------------------------------------------------
  3048.  
  3049.          Precision Control           SINGLE   1.13311278820037842E+0000
  3050.                                      DOUBLE   1.23456789006442125E+0000
  3051.                                      EXTENDED 1.23456789012337585E+0000
  3052.  
  3053.          Rounding Control            NEAREST -1.23427629010100635E+0100
  3054.                                      DOWN    -1.23427623555772409E+0100
  3055.                                      UP      -1.23457760966801097E+0100
  3056.                                      CHOP    -1.23397493540770643E+0100
  3057.  
  3058.          Denormal support
  3059.  
  3060.          SINGLE denormals supported
  3061.          SINGLE denormal prints as:    4.60943116855005E-0041
  3062.          Denormal should be printed as 4.60943...E-0041
  3063.  
  3064.          DOUBLE denormals supported
  3065.          DOUBLE denormal prints as:    8.75000000000016E-0311
  3066.          Denormal should be printed as 8.75...E-0311
  3067.  
  3068.          EXTENDED denormals supported
  3069.          EXTENDED denormal prints as:  1.31640625000000E-4934
  3070.          Denormal should be printed as 1.3164...E-4934
  3071.  
  3072.  
  3073. Results for the ULSI 83C87:
  3074. ---------------------------
  3075.  
  3076.          Precision Control           SINGLE   1.23456789012337585E+0000
  3077.                                      DOUBLE   1.23456789012337585E+0000
  3078.                                      EXTENDED 1.23456789012337585E+0000
  3079.  
  3080.          Rounding Control            NEAREST -1.23427629010100635E+0100
  3081.                                      DOWN    -1.23427623555772409E+0100
  3082.                                      UP      -1.23457760966801097E+0100
  3083.                                      CHOP    -1.23397493540770643E+0100
  3084.  
  3085.          Denormal support
  3086.  
  3087.          SINGLE denormals supported
  3088.          SINGLE denormal prints as:    4.60943116855005E-0041
  3089.          Denormal should be printed as 4.60943...E-0041
  3090.  
  3091.          DOUBLE denormals supported
  3092.          DOUBLE denormal prints as:    8.75000000000016E-0311
  3093.          Denormal should be printed as 8.75...E-0311
  3094.  
  3095.          EXTENDED denormals supported
  3096.          EXTENDED denormal prints as:  1.31640625000000E-4934
  3097.          Denormal should be printed as 1.3164...E-4934
  3098.  
  3099.  
  3100. Results for the IIT 3C87:
  3101. -------------------------
  3102.  
  3103.          Precision Control           SINGLE   1.13311278820037842E+0000
  3104.                                      DOUBLE   1.23456789006442125E+0000
  3105.                                      EXTENDED 1.23456789012337585E+0000
  3106.  
  3107.          Rounding Control            NEAREST -1.23427629010100635E+0100
  3108.                                      DOWN    -1.23427623555772409E+0100
  3109.                                      UP      -1.23457760966801097E+0100
  3110.                                      CHOP    -1.23397493540770643E+0100
  3111.  
  3112.          Denormal support
  3113.  
  3114.          SINGLE denormals supported
  3115.          SINGLE denormal prints as:    4.60943116855005E-0041
  3116.          Denormal should be printed as 4.60943...E-0041
  3117.  
  3118.          DOUBLE denormals supported
  3119.          DOUBLE denormal prints as:    8.75000000000016E-0311
  3120.          Denormal should be printed as 8.75...E-0311
  3121.  
  3122.          EXTENDED denormals not supported
  3123.  
  3124.  
  3125. Results for the Turbo Pascal 6.0 coprocessor emulator:
  3126. ------------------------------------------------------
  3127.  
  3128.          Precision Control           SINGLE   1.23456789012351396E+0000
  3129.                                      DOUBLE   1.23456789012351396E+0000
  3130.                                      EXTENDED 1.23456789012351396E+0000
  3131.  
  3132.          Rounding Control            NEAREST -1.23457766383395931E+0100
  3133.                                      DOWN    -1.23457766383395931E+0100
  3134.                                      UP      -1.23457766383395931E+0100
  3135.                                      CHOP    -1.23457766383395931E+0100
  3136.  
  3137.          Denormal support
  3138.  
  3139.          SINGLE denormals not supported
  3140.          DOUBLE denormals not supported
  3141.          EXTENDED denormals not supported
  3142.  
  3143.  
  3144. Results for the Q387 coprocessor emulator:
  3145. ------------------------------------------
  3146.  
  3147.          Precision Control           SINGLE   1.23456789012337614E+0000
  3148.                                      DOUBLE   1.23456789012337614E+0000
  3149.                                      EXTENDED 1.23456789012337614E+0000
  3150.  
  3151.          Rounding Control            NEAREST -1.23427621117212139E+0100
  3152.                                      DOWN    -1.23427621117212139E+0100
  3153.                                      UP      -1.23427621117212139E+0100
  3154.                                      CHOP    -1.23427621117212139E+0100
  3155.  
  3156.          Denormal support
  3157.  
  3158.          SINGLE denormals not supported
  3159.          DOUBLE denormals not supported
  3160.          EXTENDED denormals not supported
  3161.  
  3162.  
  3163. The test results show that the IIT 3C87 does not conform to the IEEE-754
  3164. floating-point standard in that it does not support denormals in double
  3165. extended precision. The ULSI 83C87 does not conform to that standard in that
  3166. it does not support precision control, but uses double extended precision for
  3167. all operations. The TP 6.0 emulator supports neither precision control,
  3168. rounding control nor support for any denormals, as does the Q387 emulator.
  3169. In addition, their basic arithmetic operations do not seem to conform to
  3170. the IEEE standard as the results of the test programs differ from that of
  3171. any result computed by a coprocessor for any mode.
  3172.  
  3173.  
  3174.  
  3175. ================================================
  3176. Accuracy of transcendental function calculations
  3177. ================================================
  3178.  
  3179. With regard to the accuracy of transcendental functions, Cyrix claims that
  3180. the relative error of the transcendental functions on its 83D87 coprocessor
  3181. never exceeds 0.5 ULP of the double extended format [13] (ULP = Unit in the
  3182. Last Place, numeric weight of the least significant mantissa bit). This means
  3183. that the maximum relative error is below 2**-64, while Intel's published
  3184. error limit for the 80387 is 2**-62. While Intel uses a modified CORDIC
  3185. algorithm [18,19] to compute the transcendental functions, Cyrix uses
  3186. rational approximations that utilize their chip's very fast array multiplier.
  3187. (For an explanation why this approach is superior to CORDIC with today's
  3188. technology, see [61].) Also, Cyrix uses an internal 75 bit data path for the
  3189. mantissa [15], so intermediate computations in the generation of
  3190. transcendental function values will enjoy some additional accuracy over the
  3191. 64 bits provided by the double extended format. Using 75 mantissa bits also
  3192. provides an advantage over other coprocessors like the Intel 387DX and ULSI
  3193. 83C87 which use only a 68 bit mantissa data path [58,59].
  3194.  
  3195. Note that a maximum relative error of 0.5 ULP for the Cyrix coprocessor does
  3196. not mean that it returns the 'exact' result (machine number closest to
  3197. infinitely precise result) all the time. Consider the case where the
  3198. infinitely precise result of a transcendental function falls nearly halfway
  3199. between two machine numbers. A relative error of 0.5 ULP can cause the result
  3200. to be either of the numbers after rounding, depending on the direction of the
  3201. error. But the 83D87 should deliver results that never differ from the
  3202. 'exact' result by more than one ULP. Also note that the claim of relative
  3203. error being below 0.5 ULPs is slightly exaggerated; 0.6 ULPs would be a more
  3204. realistic error limit. Imagine that the infinitely precise result for some
  3205. argument to a transcendental was xxx..xxx1001... (where the xxx...xxx
  3206. represent the first 64 bits of the result), but that the coprocessor computes
  3207. the result as xxx..xxx0111 and then round this down to xxx..xxx0000. Then the
  3208. relative error is (1001b-0b)/1000b = 0.5625 ULPs.
  3209.  
  3210. I tested some of the transcendental functions of the Cyrix 387+ and found the
  3211. relative error to be always below 0.6 ULPs. Cyrix also claims that its
  3212. transcendental functions satisfy the monotonicity criterion [13], a claim not
  3213. made by any of the competitors, which does not mean that the transcendental
  3214. functions on the other 387-compatibles may not be monotonic, too.
  3215. Monotonicity means that for all x1 > x2, it always follows that f(x1) >=
  3216. f(x2) for an increasing function like sin on [0..pi/4]. Likewise, for a
  3217. decreasing function like cos on [0..pi/4], for all x1 > x2, it follows that
  3218. f(x1) <= f(x2).
  3219.  
  3220. As previously noted, the Weitek Abacus 3167 and 4167 coprocessors implement
  3221. only the basic arithmetic operations (add, subtract, negate, multiply,
  3222. divide, square root) in hardware. Transcendental functions are performed via
  3223. a software library provided by Weitek. For these library functions Weitek
  3224. claims a maximum relative error of 5 ULPs [31,33]. This means that the last
  3225. three bits in the mantissa of a double-precision result can be wrong. Note
  3226. that the Intel 387 and compatible math coprocessors generate the
  3227. transcendental functions with a small relative error with regard to the
  3228. *extended double precision* format. Thus, when rounded to double-precision,
  3229. their function values are nearly always 'exact'. The problem of 'double
  3230. rounding' prevents them to be 'exact' in 100% of all cases. 387 type
  3231. coprocessors in general have superior accuracy when compared with Weitek's
  3232. coprocesssors.
  3233.  
  3234. The test diskette distributed with early versions of the Cyrix 83D87
  3235. contained a program (TRANCK) that checks the accuracy of the transcendental
  3236. functions in the coprocessor against a more precise software arithmetic [16].
  3237. I used this program to compare the accuracy of the transcendental functions
  3238. on those 287/387/486 coprocessors/FPUs available to me. As TRANCK will not
  3239. accept negative numbers as interval limits, I tested each function on an
  3240. interval along the positive x-axis. The functions tested were F2XM1 (2**x-1),
  3241. FSIN (sine), FCOS (cosine), FPTAN (tangent), FPATAN (arctangent), FYL2X (y *
  3242. log2 (x)), and FYL2XP1 (y * log2 (x+1)). These are all the transcendental
  3243. functions implemented on the 80387. Note that the square root (FSQRT) is
  3244. *not* a transcendental function. For each function, 100,000 arguments were
  3245. evaluated, with the arguments uniformly distributed within the interval
  3246. tested.
  3247.  
  3248. The EM87 emulator could not be checked with TRANCK, since the multiple
  3249. precision package in TRANCK would always return with an error message
  3250. immediately. However, the Franke387 emulator could be tested.
  3251.  
  3252.  
  3253. In the test results below, the following statistics are detailed:
  3254.  
  3255.        %wrong      is the percentage of results that differ from the 'exact'
  3256.                    result (infinitely precise result rounded to 64 bits)
  3257.        ULP_hi      is the number of results where the returned result was
  3258.                    greater than the 'exact' (correctly rounded) result by
  3259.                    one ULP (the numeric weight of the last mantissa bit,
  3260.                    2**-63 to 2**-64 depending of the size of the number).
  3261.        ULPs_hi     is the number of results where the returned result was
  3262.                    greater than the 'exact' result by two or more ULPs.
  3263.        ULP_lo      is the number of results where the returned result was
  3264.                    smaller than the 'exact' (correctly rounded) result by
  3265.                    one ULP (the numeric weight of the last mantissa bit,
  3266.                    2**-63 to 2**-64 depending of the size of the number).
  3267.        ULPs_lo     is the number of results where the returned result was
  3268.                    smaller than the 'exact' result by two or more ULPs.
  3269.        max ULP err is the maximum deviation of a returned result from the
  3270.                    'exact' answer expressed in ULPs.
  3271.  
  3272. Test results for accuracy of transcendental functions for double extended
  3273. precision as returned by the program TRANCK. 100,000 trials per function:
  3274.  
  3275.          Franke387 V2.4 emulator
  3276.                                                                     max
  3277.          funct. interval   %wrong ULP_hi ULPs_hi ULP_lo ULPs_lo ULP err
  3278.  
  3279.          SIN    0,pi/4      39.042  25301     708  13029       4       2
  3280.          COS    0,pi/4      75.714  49827   25887      0       0       3
  3281.          TAN    0,pi/4      76.976  14230   10029  24323   28394       9
  3282.          ATAN   0,1         55.826  26028    1529  24044    4225       4
  3283.          2XM1   0,0.5       96.717      0       0  47910   48807       5
  3284.          YL2XP1 0,sqrt(2)-1 93.007    578       9  27416   65004       8
  3285.          YL2X   0.1,10      62.252  16817    4712  37082    3641    2953
  3286.  
  3287.  
  3288.          Microsoft's coprocessor emulator
  3289.          (part of MS-C and MS-Fortran libraries)
  3290.                                                                      max
  3291.          funct. interval    %wrong ULP_hi ULPs_hi ULP_lo ULPs_lo ULP err
  3292.  
  3293.          SIN    0,pi/4         N/A    N/A     N/A    N/A     N/A     N/A
  3294.          COS    0,pi/4         N/A    N/A     N/A    N/A     N/A     N/A
  3295.          TAN    0,pi/4      40.828  27764    1520  11445      99       2
  3296.          ATAN   0,1         32.307  18893     485  12530     299       2
  3297.          2XM1   0,0.5       52.163   8585     189  37745    5644       3
  3298.          YL2XP1 0,sqrt(2)-1 88.801   4714     916  14239   68932      11
  3299.          YL2X   0.1,10      36.598  13813    3272  13866    5647      11
  3300.  
  3301.  
  3302.          INTEL 8087, 80287
  3303.                                                                      max
  3304.          funct. interval    %wrong ULP_hi ULPs_hi ULP_lo ULPs_lo ULP err
  3305.  
  3306.          SIN    0,pi/4         N/A    N/A     N/A    N/A     N/A     N/A
  3307.          COS    0,pi/4         N/A    N/A     N/A    N/A     N/A     N/A
  3308.          TAN    0,pi/4      37.001  18756     524  17405     316       2
  3309.          ATAN   0,1          9.666   6065       0   3601       0       1
  3310.          2XM1   0,0.5       19.920      0       0  19920       0       1
  3311.          YL2XP1 0,sqrt(2)-1  7.780    868       0   6912       0       1
  3312.          YL2X   0.1,10       1.287    723       0    564       0       1
  3313.  
  3314.  
  3315.          INTEL 80387
  3316.                                                                      max
  3317.          funct. interval    %wrong ULP_hi ULPs_hi ULP_lo ULPs_lo ULP err
  3318.  
  3319.          SIN    0,pi/4      28.872   2467       0  26392      13       2
  3320.          COS    0,pi/4      27.213  27169      35      9       0       2
  3321.          TAN    0,pi/4      10.532    441       0  10091       0       1
  3322.          ATAN   0,1          7.088   2386       0   4691       1       2
  3323.          2XM1   0,0.5       32.024      0       0  32024       0       1
  3324.          YL2XP1 0,sqrt(2)-1 22.611   3461       0  19150       0       1
  3325.          YL2X   0.1,10      13.020   6508       0   6512       0       1
  3326.  
  3327.  
  3328.          INTEL 387DX
  3329.                                                                      max
  3330.          funct. interval    %wrong ULP_hi ULPs_hi ULP_lo ULPs_lo ULP err
  3331.  
  3332.          SIN    0,pi/4      28.873   2467       0  26393      13       2
  3333.          COS    0,pi/4      27.121  27090      22      9       0       2
  3334.          TAN    0,pi/4      10.711    457       0  10254       0       1
  3335.          ATAN   0,1          7.088   2386       0   4691       1       2
  3336.          2XM1   0,0.5       32.024      0       0  32024       0       1
  3337.          YL2XP1 0,sqrt(2)-1 22.611   3461       0  19150       0       1
  3338.          YL2X   0.1,10      13.020   6508       0   6512       0       1
  3339.  
  3340.  
  3341.          ULSI 83C87
  3342.                                                                      max
  3343.          funct. interval    %wrong ULP_hi ULPs_hi ULP_lo ULPs_lo ULP err
  3344.  
  3345.          SIN    0,pi/4      35.530   4989       6  30238     297       2
  3346.          COS    0,pi/4      43.989  11193     675  31393     728       2
  3347.          TAN    0,pi/4      48.539  18880    1015  26349    2295       3
  3348.          ATAN   0,1         20.858     62       0  20796       0       1
  3349.          2XM1   0,0.5       21.257      4       0  21253       0       1
  3350.          YL2XP1 0,sqrt(2)-1 27.893   9446       0  18213     234       2
  3351.          YL2X   0.1,10      13.603   9816       0   3787       0       1
  3352.  
  3353.  
  3354.          IIT 3C87
  3355.                                                                      max
  3356.          funct. interval    %wrong ULP_hi ULPs_hi ULP_lo ULPs_lo ULP err
  3357.  
  3358.          SIN    0,pi/4      18.650  11171      0    7479       0       1
  3359.          COS    0,pi/4       7.700   3024      0    4676       0       1
  3360.          TAN    0,pi/4      20.973   9681      0   11291       1       2
  3361.          ATAN   0,1         19.280  13186      0    6094       0       1
  3362.          2XM1   0,0.5       25.660  17570      0    8090       0       1
  3363.          YL2XP1 0,sqrt(2)-1 45.830  23503   1896   19654     777       3
  3364.          YL2X   0.1,10      10.888   5638    357    4845      48       3
  3365.  
  3366.  
  3367.          C&T 38700DX
  3368.                                                                      max
  3369.          funct. interval    %wrong ULP_hi ULPs_hi ULP_lo ULPs_lo ULP err
  3370.  
  3371.          SIN    0,pi/4       1.821   1272      0     549       0       1
  3372.          COS    0,pi/4      23.358  12458      0   10901       0       1
  3373.          TAN    0,pi/4      17.178  10725      0    6453       0       1
  3374.          ATAN   0,1          9.359   7082      0    2277       0       1
  3375.          2XM1   0,0.5       15.188   3039      0   12149       0       1
  3376.          YL2XP1 0,sqrt(2)-1 19.497  12109      0    7388       0       1
  3377.          YL2X   0.1,10      46.868    261      0   46607       0       1
  3378.  
  3379.  
  3380.          CYRIX 83D87
  3381.                                                                      max
  3382.          funct. interval    %wrong ULP_hi ULPs_hi ULP_lo ULPs_lo ULP err
  3383.  
  3384.          SIN    0,pi/4       1.554   1015      0     539       0       1
  3385.          COS    0,pi/4       0.925    143      0     782       0       1
  3386.          TAN    0,pi/4       4.147    881      0    3266       0       1
  3387.          ATAN   0,1          0.656    229      0     427       0       1
  3388.          2XM1   0,0.5        2.628   1433      0    1194       0       1
  3389.          YL2XP1 0,sqrt(2)-1  3.242    825      0    2417       0       1
  3390.          YL2X   0.1,10       0.931    256      0     675       0       1
  3391.  
  3392.          CYRIX 387+
  3393.                                                                  max
  3394.          funct. interval    %wrong ULP_hi ULPs_hi ULP_lo ULPs_lo ULP err
  3395.  
  3396.          SIN    0,pi/4       1.486    864       0    622       0       1
  3397.          COS    0,pi/4       2.072     12       0   2060       0       1
  3398.          TAN    0,pi/4       0.602     63       0    539       0       1
  3399.          ATAN   0,1          0.384     12       0    372       0       1
  3400.          2XM1   0,0.5        1.985     27       0   1958       0       1
  3401.          YL2XP1 0,sqrt(2)-1  3.662   1705       0   1957       0       1
  3402.          YL2X   0.1,10       0.764    367       0    397       0       1
  3403.  
  3404.  
  3405.          INTEL RapidCAD, Intel 486
  3406.                                                                  max
  3407.          funct. interval    %wrong ULP_hi ULPs_hi ULP_lo ULPs_lo ULP err
  3408.  
  3409.          SIN    0,pi/4      16.991   1517       0  15474       0       1
  3410.          COS    0,pi/4       9.003   7603       0   1400       0       1
  3411.          TAN    0,pi/4      10.532    441       0  10091       0       1
  3412.          ATAN   0,1          7.078   2386       0   4691       1       2
  3413.          2XM1   0,0.5       32.025      0       0  32025       0       1
  3414.          YL2XP1 0,sqrt(2)-1 21.800    533       0  21267       0       1
  3415.          YL2X   0.1,10       3.894   1879       0   2015       0       1
  3416.  
  3417.  
  3418. Discussion of the transcendental function tests
  3419. -----------------------------------------------
  3420.  
  3421. The test results above indicate that all 80x87 compatibles do not exceed
  3422. Intel's stated error bound of 3 ULPs for the transcendental functions.
  3423. However, some coprocessors are more accurate than others. Rating the
  3424. coprocessors according to the accuracy of their transcendental functions
  3425. gives the following list (highest accuracy first): Cyrix 387+, Cyrix 83D87,
  3426. Intel 486, Intel RapidCAD, Intel 80287(!), C&T 38700DX, Intel 387DX, Intel
  3427. 80387, IIT 3C87, ULSI 83C87. The tests also show that the problems with
  3428. excessive inaccuracy of the transcendental functions in early versions of the
  3429. IIT coprocessors with errors of up to 8 ULPs [8] have been corrected.
  3430. (According to [56], certain problems with the FPATAN instruction on the IIT
  3431. 3C87 occurring under the UNIX version of AutoCAD were corrected in June,
  3432. 1990.)
  3433.  
  3434. Considering the coprocessor emulators, the Franke387 has acceptable accuracy
  3435. for the FSIN, FCOS, and FPATAN instructions, taking into consideration that
  3436. according to its documentation, Franke387 uses only 64 bits of precision for
  3437. the intermediate results, while coprocessors typically use 68 bits and more.
  3438. However, the larger error in the FPTAN, F2XM1, FYL2XP1, and especially the
  3439. FYL2X operations show that the emulator doesn't use state-of-the-art
  3440. algorithms, which ensure an error of only a very few ULPs even if no extra
  3441. precise intermediate results are available. Microsoft's emulator, meanwhile,
  3442. provides transcendental functions with rather good accuracy, except for the
  3443. logarithmic operations, which contain some minor flaws. The Q387 emulator,
  3444. which came out only recently and is the fastest emulator available, could
  3445. unfortunately not be tested since it caused TRANCK to abort with a GP (general
  3446. protection) fault for every input that I tried.
  3447.  
  3448.  
  3449.  
  3450. ======================================================
  3451. Intel 387DX compatibility testing / The SMDIAG program
  3452. ======================================================
  3453.  
  3454. Chips and Technologies has included the program SMDIAG on the V1.0 diagnostic
  3455. disk distributed with its SuperMATH 38700DX coprocessor. Its stated purpose
  3456. is to test the compatibility of the computational results and flag settings
  3457. returned by the C&T coprocessor with the Intel 387DX. However, the tests for
  3458. the transcendental functions seem to have been tweaked to let the C&T 38700DX
  3459. pass, while coprocessors like the Intel RapidCAD and the Cyrix 83D87 fail.
  3460. Also, SMDIAG shows failure in the FSCALE test for the Intel RapidCAD, Cyrix
  3461. 83D87, Cyrix 387+, and ULSI 83C87, even though they return the correct result
  3462. according to Intel's documentation for the Intel 387DX (Intel's second
  3463. generation 387), which is indeed returned by the 387DX. (SMDIAG apparently
  3464. expects the result returned by the original Intel 80387.)
  3465.  
  3466. Note that chip manufacturers often do quite bug fixes, so it wouldn't be
  3467. surprising if somebody else, using different runs of the same manufacturer's
  3468. chip, came up with different results than the ones below. The Intel 387 alone
  3469. seems to have been produced in four different versions that can be told apart
  3470. by software, and Cyrix, ULSI, and IIT have manufactured at least two versions
  3471. each of their coprocessors. (The coprocessors I tested have the following
  3472. manufacturing dates stamped on them. Intel 387DX: 91/49, C&T 38700DX: 92/19,
  3473. Cyrix 387+: 92/11, Intel RapidCAD: 92/05, ULSI 83C87: 91/48, IIT 3C87:
  3474. 92/20.)
  3475.  
  3476.        Results of running the SMDIAG program on 387-compatible coprocessors
  3477.        (p = passed, f = failed)
  3478.  
  3479.                       Intel Intel Intel Cyrix Cyrix   IIT  ULSI   C&T
  3480.        Test        RapidCAD 387DX 80387  387+ 83D87  3C87 83C87 38700
  3481.  
  3482.        1  (fstore)        f     p     p     p     f     f     f     p ##,%%
  3483.        2  (fiall)         p     p     p     p     p     p     f     p
  3484.        3  (faddsub)       p     p     p     p     p     p     p     p
  3485.        4  (faddsub_nr)    p     p     p     p     f     f     f     p %%
  3486.        5  (faddsub_cp)    p     p     p     p     f     f     f     p %%
  3487.        6  (faddsub_dn)    p     p     p     p     f     f     f     p %%
  3488.        7  (faddsub_up)    p     p     p     p     f     f     f     p %%,&&
  3489.        8  (fmul)          p     p     p     p     p     f     f     p
  3490.        9  (fdivn)         p     p     p     p     p     p     p     p
  3491.        10 (fdiv)          p     p     p     p     p     p     f     p
  3492.        11 (fxch)          p     p     p     p     p     p     p     p
  3493.        12 (fyl2x)         p     p     p     f     f     f     f     p ++
  3494.        13 (fyl2xp1)       f     p     p     f     f     f     f     p ++
  3495.        14 (fsqrt)         p     p     p     p     p     p     p     p
  3496.        15 (fsincos)       f     p     p     f     f     f     f     p ++
  3497.        16 (fptan)         p     p     p     f     p     f     f     p ++
  3498.        17 (fpatan)        p     p     p     f     f     f     f     p ++
  3499.        18 (f2xm1)         p     p     p     f     f     f     f     p ++
  3500.        19 (fscale)        f     f     p     f     f     f     f     p **
  3501.        20 (fcom1)         p     p     p     p     p     f     f     p
  3502.        21 (fprem)         p     p     p     p     p     p     p     p
  3503.        22 (misc1)         p     p     p     p     p     f     f     p
  3504.        23 (misc3)         p     p     p     p     p     p     p     p
  3505.        24 (misc4)         p     p     p     p     f     f     p     p %%
  3506.  
  3507.        failed modules:    4     1     0     7    12    16    17     0
  3508.  
  3509.  
  3510.        ## the failure of the Intel RapidCAD is caused by the fact that
  3511.           it stores the value of BCD INDEFINITE differently from the
  3512.           Intel 387DX. It uses FFFFC000000000000000, while the 387DX uses
  3513.           FFFF8000000000000000. However, both encodings are valid according
  3514.           to Intel's documentation, which defines the BCD INDEFINITE as
  3515.           FFFFUUUUUUUUUUUUUUUU, where U is undefined. So failure of the
  3516.           RapidCAD to deliver the same answer as the 387DX is not an
  3517.           "error", just a very slight incompatibility.
  3518.        ** the FSCALE errors reported for the Intel 387DX, Intel RapidCAD,
  3519.           Cyrix 83D87, Cyrix 387+, and ULSI 83C87 are due to a single
  3520.           'wrong' result each returned by one of the FSCALE computations.
  3521.           SMDIAG expects the result returned by the first generation
  3522.           Intel 80387 (and, of course, the C&T 38700DX). However, this
  3523.           result is wrong according to Intel's documentation and the
  3524.           behavior was corrected in the second generation Intel 387DX.
  3525.           Therefore, the Intel RapidCAD, Cyrix 83D87, Cyrix 387+, and ULSI
  3526.           83C87 return the correct result compatible with the Intel 387DX.
  3527.        %% Failures reported for the Cyrix 83D87 are due to the fact that it
  3528.           converts pseudodenormals contained in its registers to normalized
  3529.           numbers upon storing them to memory with the FSTP TBYTE PTR
  3530.           instruction. Intel's processors store pseudodenormals without
  3531.           'normalizing' them. This is an incompatibility, but not an error,
  3532.           because both encodings will evaluate to the same value should
  3533.           they be reused in a calculation.
  3534.        && Two of the failures reported for the Cyrix 83D87 are actual
  3535.           errors where the Cyrix 83D87 fails to deliver the correct result.
  3536.           1) control word = 0A7F (closure=proj., round=up, precision=53bit)
  3537.              ST(0) = 0001 ABCEF9876542101
  3538.              ST(1) = 0001 800000000345FFF
  3539.              instruction: FSUBRP ST(1), ST
  3540.              result should be: 0000 2BCEF987650EC800, status word = 3A30
  3541.              83D87 returns:    0000 3BCEF987650EC000, status word = 3830
  3542.           2) control word = 0A7F (closure=proj., round=up, precision=53bit)
  3543.              ST(0) = 0001 ABCEF9876542101
  3544.              ST(1) = 0001 800000000000000
  3545.              instruction: FSUB ST, ST(1)
  3546.              result should be: 0000 2BCEF98765432800, status word = 3A30
  3547.              83D87 returns:    0000 3BCEF98765432000, status word = 3830
  3548.        ++ The failures for the test of transcendental functions are caused
  3549.           by the tested coprocessor returning results that differ from the
  3550.           ones returned by the Intel 387DX. On the Cyrix 83D87, Cyrix 387+,
  3551.           and Intel RapidCAD, this is simply due to the improved accuracy
  3552.           these coprocessors provide over the Intel 387DX. The failures of
  3553.           the IIT 3C87 and ULSI 83C87 are mainly due to the lesser accuracy
  3554.           in the transcendental functions of these coprocessors, but for
  3555.           the IIT 3C87 an additional source of failures is its inability to
  3556.           handle extended-precision denormals.
  3557.  
  3558.  
  3559. Another compatibility issue that has been discussed on Usenet is the behavior
  3560. of the math coprocessors under protected-mode operating systems. I have seen
  3561. postings claiming that coprocessors from ULSI, IIT, and Cyrix locked up the
  3562. machine when a protected mode operating system (several UNIX derivatives were
  3563. also mentioned) was run on them. However, there have also been reports that
  3564. several 486-based systems also have this problem, while others do not.
  3565. Therefore, I think most of these problems are caused by poor motherboard
  3566. design, especially wrong handling of error interrupts coming from the
  3567. coprocessor. There could also be bugs in the exception handlers of the
  3568. operating system.
  3569.  
  3570.  
  3571.  
  3572. ==========
  3573. References
  3574. ==========
  3575.  
  3576. [1]  Schnurer, G.: Zahlenknacker im Vormarsch. c't 1992, Heft 4, Seiten 170-
  3577.      186
  3578.  
  3579. [2]  Curnow, H.J.; Wichmann, B.A.: A synthetic benchmark. Computer Journal,
  3580.      Vol. 19, No. 1, 1976, pp. 43-49
  3581.  
  3582. [3]  Wichmann, B.A.: Validation code for the Whetstone benchmark. NPL Report
  3583.      DITC 107/88, National Physics Laboratory, UK, March 1988
  3584.  
  3585. [4]  Curnow, H.J.: Wither Whetstone? The Synthetic Benchmark after 15 Years.
  3586.      In: Aad van der Steen (ed.): Evaluating Supercomputers. London: Chapman
  3587.      and Hall 1990
  3588.  
  3589. [5]  Dongarra, J.J.: The Linpack Benchmark: An Explanation. In: Aad van der
  3590.      Steen (ed.): Evaluating Supercomputers. London: Chapman and Hall 1990
  3591. [6]  Dongarra, J.J.: Performance of Various Computers Using Standard Linear
  3592.      Equations Software. Report CS-89-85, Computer Science Department,
  3593.      University of Tennessee, March 11, 1992
  3594.  
  3595. [7]  Huth, N.: Dichtung und Wahrheit oder Datenblatt und Test. Design &
  3596.      Elektronik 1990, Heft 13, Seiten 105-110
  3597.  
  3598. [8]  Ungerer, B.: Sockelfolger. c't 1990, Heft 4, Seiten 162-163
  3599.  
  3600. [9]  Coonen, J.T.: Contributions to a Proposed Standard for Binary Floating-
  3601.      Point Arithmetic Ph.D. thesis, University of California, Berkeley, 1984
  3602.  
  3603. [10] IEEE: IEEE Standard for Binary Floating-Point Arithmetic. SIGPLAN
  3604.      Notices, Vol. 22, No. 2, 1985, pp. 9-25
  3605.  
  3606. [11] IEEE Standard for Binary Floating-Point Arithmetic. ANSI/IEEE Std 754-
  3607.      1985. New York, NY: Institute of Electrical and Electronics Engineers
  3608.      1985
  3609.  
  3610. [12] FasMath 83D87 Compatibility Report. Cyrix Corporation, Nov. 1989 Order
  3611.      No. B2004
  3612.  
  3613. [13] FasMath 83D87 Accuracy Report. Cyrix Corporation, July 1990 Order No.
  3614.      B2002
  3615.  
  3616. [14] FasMath 83D87 Benchmark Report. Cyrix Corporation, June 1990 Order No.
  3617.      B2004
  3618.  
  3619. [15] FasMath 83D87 User's Manual. Cyrix Corporation, June 1990 Order No.
  3620.      L2001-003
  3621.  
  3622. [16] Brent, R.P.: A FORTRAN multiple-precision arithmetic package. ACM
  3623.      Transactions on Mathematical Software, Vol. 4, No. 1, March 1978, pp.
  3624.      57-70
  3625.  
  3626. [17] 387DX User's Manual, Programmer's Reference. Intel Corporation, 1989
  3627.      Order No. 231917-002
  3628.  
  3629. [18] Volder, J.E.: The CORDIC Trigonometric Computing Technique. IRE
  3630.      Transactions on Electronic Computers, Vol. EC-8, No. 5, September 1959,
  3631.      pp. 330-334
  3632.  
  3633. [19] Walther, J.S.: A unified algorithm for elementary functions. AFIPS
  3634.      Conference Proceedings, Vol. 38, SJCC 1971, pp. 379-385
  3635.  
  3636. [20] Esser, R.; Kremer, F.; Schmidt, W.G.: Testrechnungen auf der IBM 3090E
  3637.      mit Vektoreinrichtung. Arbeitsbericht RRZK-8803, Regionales
  3638.      Rechenzentrum an der Universit"at zu Köln, Februar 1988
  3639.  
  3640. [21] McMahon, H.H.: The Livermore Fortran Kernels: A test of the numerical
  3641.      performance range. Technical Report UCRL-53745, Lawrence Livermore
  3642.      National Laboratory, USA, December 1986
  3643.  
  3644. [22] Nave, R.: Implementation of Transcendental Functions on a Numerics
  3645.      Processor. Microprocessing and Microprogramming, Vol. 11, No. 3-4,
  3646.      March-April 1983, pp. 221-225
  3647.  
  3648. [23] Yuen, A.K.: Intel's Floating-Point Processors. Electro/88 Conference
  3649.      Record, Boston, MA, USA, 10-12 May 1988, pp. 48/5-1 - 48/5-7
  3650.  
  3651. [24] Stiller, A.; Ungerer, B.: Ausgerechnet. c't 1990, Heft 1, Seiten 90-92
  3652.  
  3653. [25] Rosch, W.L.: Handfeste Hilfe oder Seifenblase? PC Professionell, Juni
  3654.      1991, Seiten 214-237
  3655. [26] Intel 80286 Hardware Reference Manual. Intel Corporation, 1987 Order
  3656.      No.210760-002
  3657.  
  3658. [27] AMD 80C287 80-bit CMOS Numeric Processor. Advanced Micro Devices, June
  3659.      1989 Order No. 11671B/0
  3660.  
  3661. [28] Intel RapidCAD(tm) Engineering CoProcessor Performance Brief. Intel
  3662.      Corporation, 1992
  3663.  
  3664. [29] i486(tm) Microprocessor Performance Report. Intel Corporation, April
  3665.      1990 Order No. 240734-001
  3666.  
  3667. [30] Intel486(tm) DX2 Microprocessor Performance Brief. Intel Corporation,
  3668.      March 1992 Order No. 241254-001
  3669.  
  3670. [31] Abacus 3167 Floating-Point Coprocessor Data Book. Weitek Corporation,
  3671.      July 1990 DOC No. 9030
  3672.  
  3673. [32] WTL 4167 Floating-Point Coprocessor Data Book. Weitek Corporation, July
  3674.      1989 DOC No. 8943
  3675.  
  3676. [33] Abacus Software Designer's Guide. Weitek Corporation, September 1989 DOC
  3677.      No. 8967
  3678.  
  3679. [34] Stiller, A.: Cache & Carry. c't 1992, Heft 6, Seiten 118-130
  3680.  
  3681. [35] Stiller, A.: Cache & Carry, Teil 2. c't 1992, Heft 7, Seiten 28-34
  3682.  
  3683. [36] Palmer, J.F.; Morse, S.P.: Die mathematischen Grundlagen der Numerik-
  3684.      Prozessoren 8087/80287. München: tewi 1985
  3685.  
  3686. [37] 80C187 80-bit Math Coprocessor Data Sheet. Intel Corporation, September
  3687.      1989 Order No. 270640-003
  3688.  
  3689. [38] IIT-2C87 80-bit Numeric Co-Processor Data Sheet. IIT, May 1990
  3690.  
  3691. [39] Engineering note 4x4 matrix multiply transformation. IIT, 1989
  3692.  
  3693. [40] Tscheuschner, E.: 4 mal 4 auf einen Streich. c't 1990, Heft 3, Seiten
  3694.      266-276
  3695.  
  3696. [41] Goldberg, D.: Computer Arithmetic. In: Hennessy, J.L.; Patterson, D.A.:
  3697.      Computer Architecture A Quantitative Approach. San Mateo, CA: Morgan
  3698.      Kaufmann 1990
  3699.  
  3700. [42] 8087 Math Coprocessor Data Sheet. Intel Corporation, October 1989, Order
  3701.      No. 205835-007
  3702.  
  3703. [43] 8086/8088 User's Manual, Programmer's and Hardware Reference. Intel
  3704.      Corporation, 1989 Order No. 240487-001
  3705.  
  3706. [44] 80286 and 80287 Programmer's Reference Manual. Intel Corporation, 1987
  3707.      Order No. 210498-005
  3708.  
  3709. [45] 80287XL/XLT CHMOS III Math Coprocessor Data Sheet. Intel Corporation,
  3710.      May 1990 Order No. 290376-001
  3711.  
  3712. [46] Cyrix FasMath(tm) 82S87 Coprocessor Data Sheet. Cyrix Coporation, 1991
  3713.      Document 94018-00 Rev. 1.0
  3714.  
  3715. [47] IIT-3C87 80-bit Numeric Co-Processor Data Sheet. IIT, May 1990
  3716.  
  3717. [48] 486(tm)SX(tm) Microprocessor/ 487(tm)SX(tm) Math CoProcessor Data Sheet.
  3718.      Intel Corporation, April 1991. Order No. 240950-001
  3719.  
  3720. [49] Schnurer, G.: Die gro"se Verlade. c't 1991, Heft 7, Seiten 55-57
  3721.  
  3722. [50] Schnurer, G.: Eine 4 f"ur alle. c't 1991, Heft 6, Seite 25
  3723.  
  3724. [51] Intel486(tm)DX Microprocessor Data Book. Intel Corporation, June 1991
  3725.      Order No. 240440-004
  3726.  
  3727. [52] i486(tm) Microprocessor Hardware Reference Manual. Intel Corporation,
  3728.      1990 Order No. 240552-001
  3729.  
  3730. [53] i486(tm) Microprocessor Programmer's Reference Manual. Intel
  3731.      Corporation, 1990 Order No. 240486-001
  3732.  
  3733. [54] Ungerer, B.: Kalte H"ute. c't 1992, Heft 8, Seiten 140-144
  3734.  
  3735. [55] Ungerer, B.: Hei"se Sache. c't 1991, Heft 4, Seiten 104-108
  3736.  
  3737. [56] Rosch, W.L.: Handfeste Hilfe oder Seifenblase? PC Profesionell, Juni
  3738.      1991, Seiten 214-237
  3739.  
  3740. [57] Niederkr"uger, W.: Lebendige Vergangenheit. c't 1990, Heft 12, Seiten
  3741.      114-116
  3742.  
  3743. [58] ULSI Math*Co Advanced Math Coprocessor Technical Specification. ULSI
  3744.      System, 5/92, Rev. E
  3745.  
  3746. [59] 387(tm)DX Math CoProcessor Data Sheet. Intel Corporation, September
  3747.      1990. Order No. 240448-003
  3748.  
  3749. [60] 387(tm) Numerics Coprocessor Extension Data Sheet. Intel Corporation,
  3750.      February 1989. Order No. 231920-005
  3751.  
  3752. [61] Koren, I.; Zinaty, O.: Evaluating Elementary Functions in a Numerical
  3753.      Coprocessor Based on Rational Approximations. IEEE Transactions on
  3754.      Computers, Vol. C-39, No. 8, August 1990, pp. 1030-1037
  3755.  
  3756. [62] 387(tm) SX Math CoProcessor Data Sheet. Intel Corporation, November 1989
  3757.      Order No. 240225-005
  3758.  
  3759. [63] Frenkel, G.: Coprocessors Speed Numeric Operations. PC-Week, August 27,
  3760.      1990
  3761.  
  3762. [64] Schnurer, G.; Stiller, A.: Auto-Matt. c't 1991, Heft 10, Seiten 94-96
  3763.  
  3764. [65] Grehan, R.: FPU Face-Off. Byte, November 1990, pp. 194-200
  3765.  
  3766. [66] Tang, P.T.P.: Testing Computer Arithmetic by Elementary Number Theory.
  3767.      Preprint MCS-P84-0889, Mathematics and Computer Science Division,
  3768.      Argonne National Laboratory, August 1989
  3769.  
  3770. [67] Ferguson, W.E.: Selecting math coprocessors. IEEE Spectrum, July 1991,
  3771.      pp. 38-41
  3772.  
  3773. [68] Schnabel, J.: Viermal 387. Computer Pers"onlich 1991, Heft 22, Seiten
  3774.      153-156
  3775.  
  3776. [69] Hofmann, J.: Starke Rechenknechte. mc 1990, Heft 7, Seiten 64-67
  3777.  
  3778. [70] Woerrlein, H.; Hinnenberg, R.: Die Lust an der Power. Computer Live
  3779.      1991, Heft 10, Seiten 138-149
  3780.  
  3781. [71] email from Peter Forsberg (peterf@vnet.ibm.com), email from Alan Brown
  3782.      (abrown@Reston.ICL.COM)
  3783.  
  3784. [72] email from Eric Johnson (johnsone%camax01@uunet.UU.NET), email from
  3785.      Jerry Whelan (guru@stasi.bradley.edu), email from Arto Viitanen
  3786.      (av@cs.uta.fi), email from Richard Krehbiel (richk@grebyn.com)
  3787.  
  3788. [73] email from Fred Dunlap (cyrix!fred@texsun.Central.Sun.COM)
  3789.  
  3790. [74] correspondence with Bengt Ask (f89ba@efd.lth.se)
  3791.  
  3792. [75] email from Thomas Hoberg (tmh@prosun.first.gmd.de)
  3793.  
  3794. [76] Microsoft Macro Assembler Programmer's Guide Version 6.0, Microsoft
  3795.      Corporation, 1991. Document No. LN06556-0291
  3796.  
  3797. [77] FasMath EMC87 User's Manual, Rev. 2. Cyrix Corporation, February 1991
  3798.      Order No. 90018-00
  3799.  
  3800. [78] Persson, C.: Die 32-Bit-Parade c't 1992, Heft 9, Seiten 150-156
  3801.  
  3802. [79] email from Duncan Murdoch (dmurdoch@mast.QueensU.CA)
  3803.  
  3804.  
  3805.  
  3806. ========================
  3807. Manufacturer's addresses
  3808. ========================
  3809.  
  3810.   Intel Corporation
  3811.   3065 Bowers Avenue
  3812.   Santa Clara, CA 95051
  3813.   USA
  3814.  
  3815.   IIT Integrated Information Technology, Inc.
  3816.   2540 Mission College Blvd.
  3817.   Santa Clara, CA 95054
  3818.   USA
  3819.  
  3820.   ULSI Systems, Inc.
  3821.   58 Daggett Drive
  3822.   San Jose, CA 95134
  3823.   USA
  3824.  
  3825.   Chips & Technologies, Inc.
  3826.   3050 Zanker Road
  3827.   San Jose, CA 95134
  3828.   USA
  3829.  
  3830.   Weitek Corporation
  3831.   1060 East Arques Avenue
  3832.   Sunnyvale, CA 94086
  3833.   USA
  3834.  
  3835.   AMD Advanced Microdevices, Inc.
  3836.   901 Thompson Place
  3837.   P.O.B. 3453
  3838.   Sunnyvale, CA 94088-3453
  3839.   USA
  3840.  
  3841.   Cyrix Corporation
  3842.   P.O.B. 850118
  3843.   Richardson, TX 75085
  3844.   USA
  3845.  
  3846.  
  3847.  
  3848. ===============================
  3849. Appendix A: Test program source
  3850. ===============================
  3851.  
  3852.   {$N+,E+}
  3853.   PROGRAM PCtrl;
  3854.  
  3855.   VAR B,c: EXTENDED;
  3856.       Precision, L: WORD;
  3857.  
  3858.   PROCEDURE SetPrecisionControl (Precision: WORD);
  3859.   (* This procedure sets the internal precision of the NDP. Available *)
  3860.   (* precision values:  0  -  24 bits (SINGLE)                        *)
  3861.   (*                    1  -  n.a. (mapped to single)                 *)
  3862.   (*                    2  -  53 bits (DOUBLE)                        *)
  3863.   (*                    3  -  64 bits (EXTENDED)                      *)
  3864.  
  3865.   VAR CtrlWord: WORD;
  3866.  
  3867.   BEGIN {SetPrecisionCtrl}
  3868.      IF Precision = 1 THEN
  3869.         Precision := 0;
  3870.      Precision := Precision SHL 8; { make mask for PC field in ctrl word}
  3871.      ASM
  3872.         FSTCW    [CtrlWord]        { store NDP control word }
  3873.         MOV      AX, [CtrlWord]    { load control word into CPU }
  3874.         AND      AX, 0FCFFh        { mask out precision control field }
  3875.         OR       AX, [Precision]   { set desired precision in PC field }
  3876.         MOV      [CtrlWord], AX    { store new control word }
  3877.         FLDCW    [CtrlWord]        { set new precision control in NDP }
  3878.      END;
  3879.   END; {SetPrecisionCtrl}
  3880.  
  3881.   BEGIN {main}
  3882.      FOR Precision := 1 TO 3 DO BEGIN
  3883.         B := 1.2345678901234567890;
  3884.         SetPrecisionControl (Precision);
  3885.         FOR L := 1 TO 20 DO BEGIN
  3886.            B := Sqrt (B);
  3887.         END;
  3888.         FOR L := 1 TO 20 DO BEGIN
  3889.            B := B*B;
  3890.         END;
  3891.         SetPrecisionControl (3);   { full precision for printout }
  3892.         WriteLn (Precision, B:28);
  3893.      END;
  3894.   END.
  3895.  
  3896.  
  3897.   +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3898.  
  3899.   {$N+,E+}
  3900.   PROGRAM RCtrl;
  3901.  
  3902.   VAR B,c: EXTENDED;
  3903.       RoundingMode, L: WORD;
  3904.  
  3905.  
  3906.   PROCEDURE SetRoundingMode (RCMode: WORD);
  3907.   (* This procedure selects one of four available rounding modes *)
  3908.   (* 0  -  Round to nearest (default)                            *)
  3909.   (* 1  -  Round down (towards negative infinity)                *)
  3910.   (* 2  -  Round up (towards positive infinity)                  *)
  3911.   (* 3  -  Chop (truncate, round towards zero)                   *)
  3912.  
  3913.   VAR CtrlWord: WORD;
  3914.  
  3915.   BEGIN
  3916.      RCMode := RCMode SHL 10;  { make mask for RC field in control word}
  3917.      ASM
  3918.         FSTCW    [CtrlWord]        { store NDP control word }
  3919.         MOV      AX, [CtrlWord]    { load control word into CPU }
  3920.         AND      AX, 0F3FFh        { mask out rounding control field }
  3921.         OR       AX, [RCMode]      { set desired precision in RC field }
  3922.         MOV      [CtrlWord], AX    { store new control word }
  3923.         FLDCW    [CtrlWord]        { set new rounding control in NDP }
  3924.      END;
  3925.   END;
  3926.  
  3927.   BEGIN
  3928.      FOR RoundingMode := 0 TO 3 DO BEGIN
  3929.         B := 1.2345678901234567890e100;
  3930.         SetRoundingMode (RoundingMode);
  3931.         FOR L := 1 TO 51 DO BEGIN
  3932.            B := Sqrt (B);
  3933.         END;
  3934.            FOR L := 1 TO 51 DO BEGIN
  3935.            B := -B*B;
  3936.         END;
  3937.         SetRoundingMode (0);        { round to nearest for printout }
  3938.         WriteLn (RoundingMode, B:28);
  3939.      END;
  3940.   END.
  3941.  
  3942.  
  3943.   +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3944.  
  3945.   {$N+,E+}
  3946.  
  3947.   PROGRAM DenormTs;
  3948.  
  3949.   VAR E: EXTENDED;
  3950.       D: DOUBLE;
  3951.       S: SINGLE;
  3952.  
  3953.   BEGIN
  3954.      WriteLn ('Testing support and printing of denormals');
  3955.      WriteLn;
  3956.      Write ('Coprocessor is: ');
  3957.      CASE Test8087 OF
  3958.         0: WriteLn ('Emulator');
  3959.         1: WriteLn ('8087 or compatible');
  3960.         2: WriteLn ('80287 or compatible');
  3961.         3: WriteLn ('80387 or compatible');
  3962.      END;
  3963.      WriteLn;
  3964.      S := 1.18e-38;
  3965.      S := S * 3.90625e-3;
  3966.      IF S = 0 THEN
  3967.         WriteLn ('SINGLE denormals not supported')
  3968.      ELSE BEGIN
  3969.         WriteLn ('SINGLE denormals supported');
  3970.         WriteLn ('SINGLE denormal prints as:   ', S);
  3971.         WriteLn ('Denormal should be printed as 4.60943...E-0041');
  3972.      END;
  3973.      WriteLn;
  3974.      D := 2.24e-308;
  3975.      D := D * 3.90625e-3;
  3976.      IF D = 0 THEN
  3977.         WriteLn ('DOUBLE denormals not supported')
  3978.      ELSE BEGIN
  3979.         WriteLn ('DOUBLE denormals supported');
  3980.         WriteLn ('DOUBLE denormal prints as:   ', D);
  3981.         WriteLn ('Denormal should be printed as 8.75...E-0311');
  3982.      END;
  3983.      WriteLn;
  3984.      E := 3.37e-4932;
  3985.      E := E * 3.90625e-3;
  3986.      IF E = 0 THEN
  3987.         WriteLn ('EXTENDED denormals not supported')
  3988.      ELSE BEGIN
  3989.         WriteLn ('EXTENDED denormals supported');
  3990.         WriteLn ('EXTENDED denormal prints as: ', E);
  3991.         WriteLn ('Denormal should be printed as 1.3164...E-4934');
  3992.      END;
  3993.   END.
  3994.  
  3995.  
  3996.  
  3997. ====================================
  3998. Appendix B: Benchmark program source
  3999. ====================================
  4000.  
  4001.  
  4002.   ; FILE: APFELM4.ASM
  4003.   ; assemble with MASM /e APFELM4 or TASM /e APFELM4
  4004.  
  4005.  
  4006.   CODE        SEGMENT BYTE PUBLIC 'CODE'
  4007.               ASSUME  CS: CODE
  4008.  
  4009.               PAGE    ,120
  4010.  
  4011.               PUBLIC  APPLE87;
  4012.  
  4013.   APPLE87     PROC    NEAR
  4014.               PUSH    BP                  ; save caller's base pointer
  4015.               MOV     BP, SP              ; make new frame pointer
  4016.               PUSH    DS                  ; save caller's data segment
  4017.               PUSH    SI                  ; save register
  4018.               PUSH    DI                  ;  variables
  4019.               LDS     BX, [BP+04]         ; pointer to parameter record
  4020.               FINIT                       ; init 80x87          FSP->R0
  4021.               FILD   WORD  PTR [BX+02]    ; maxrad              FSP->R7
  4022.               FLD    QWORD PTR [BX+08]    ; qmax                FSP->R6
  4023.               FSUB   QWORD PTR [BX+16]    ; qmax-qmin           FSP->R6
  4024.               DEC    WORD  PTR [BX+04]    ; ymax-1
  4025.               FIDIV  WORD  PTR [BX+04]    ; (qmax-qmin)/(ymax-1)FSP->R6
  4026.               FSTP   QWORD PTR [BX+16]    ; save delta_q        FSP->R7
  4027.               FLD    QWORD PTR [BX+24]    ; pmax                FSP->R6
  4028.               FSUB   QWORD PTR [BX+32]    ; pmax-pmin           FSP->R6
  4029.               DEC    WORD  PTR [BX+06]    ; xmax-1
  4030.               FIDIV  WORD  PTR [BX+06]    ; delta_p             FSP->R6
  4031.               MOV    AX, [BX]             ; save maxiter,[BX] needed for
  4032.               MOV    [BX+2], AX           ;  80x87 status now
  4033.               XOR    BP, BP               ; y=0
  4034.               FLD    QWORD PTR [BX+08]    ; qmax                FSP->R5
  4035.               CMP    WORD  PTR [BX+40], 0 ; fast mode on 8087 desired ?
  4036.               JE     yloop                ; no, normal mode
  4037.               FSTCW  [BX]                 ; save NDP control word
  4038.               AND    WORD PTR [BX], 0FCFFh; set PCTRL = single-precision
  4039.               FLDCW  [BX]                 ; get back NDP control word
  4040.   yloop:      XOR    DI, DI               ; x=0
  4041.               FLD    QWORD PTR [BX+32]    ; pmin                FSP->R4
  4042.   xloop:      FLDZ                        ; j**2= 0             FSP->R3
  4043.               FLDZ                        ; 2ij = 0             FSP->R2
  4044.               FLDZ                        ; i**2= 0             FSP->R1
  4045.               MOV    CX, [BX+2]           ; maxiter
  4046.               MOV    DL, 41h              ; mask for C0 and C3 cond.bits
  4047.   iteration:  FSUB   ST, ST(2)            ; i**2-j**2           FSP->R1
  4048.               FADD   ST, ST(3)            ; i**2-j**2+p = i     FSP->R1
  4049.               FLD    ST(0)                ; duplicate i         FSP->R0
  4050.               FMUL   ST(1), ST            ; i**2                FSP->R0
  4051.               FADD   ST, ST(0)            ; 2i                  FSP->R0
  4052.               FXCH   ST(2)                ; 2*i*j               FSP->R0
  4053.               FADD   ST, ST(5)            ; 2*i*j+q = j         FSP->R0
  4054.               FMUL   ST(2), ST            ; 2*i*j               FSP->R0
  4055.               FMUL   ST, ST(0)            ; j**2                FSP->R0
  4056.               FST    ST(3)                ; save j**2           FSP->R0
  4057.               FADD   ST, ST(1)            ; i**2+j**2           FSP->R0
  4058.               FCOMP  ST(7)                ; i**2+j**2 > maxrad? FSP->R1
  4059.               FSTSW  [BX]                 ; save 80x87 cond.codeFSP->R1
  4060.               TEST   BYTE PTR [BX+1], DL  ; test carry and zero flags
  4061.               LOOPNZ iteration            ; until maxiter if not diverg.
  4062.               MOV    DX, CX               ; number of loops executed
  4063.               NEG    CX                   ; carry set if CX <> 0
  4064.               ADC    DX, 0                ; adjust DX if no. of loops<>0
  4065.  
  4066.               ; plot point here (DI = X, BP = y, DX has the color)
  4067.  
  4068.               FSTP   ST(0)                ; pop i**2            FSP->R2
  4069.               FSTP   ST(0)                ; pop 2ij             FSP->R3
  4070.               FSTP   ST(0)                ; pop j**2            FSP->R4
  4071.               FADD   ST,ST(2)             ; p=p+delta_p         FSP->R4
  4072.               INC    DI                   ; x:=x+1
  4073.               CMP    DI, [BX+6]           ; x > xmax ?
  4074.               JBE    xloop                ; no, continue on same line
  4075.               FSTP   ST(0)                ; pop p               FSP->R5
  4076.               FSUB   QWORD PTR [BX+16]    ; q=q-delta_q         FSP->R5
  4077.               INC    BP                   ; y:=y+1
  4078.               CMP    BP, [BX+4]           ; y > ymax ?
  4079.               JBE    yloop                ; no, picture not done yet
  4080.  
  4081.   groesser:   POP    DI                   ; restore
  4082.               POP    SI                   ;  register variables
  4083.               POP    DS                   ; restore caller's data segm.
  4084.               POP    BP                   ; save caller's base pointer
  4085.               RET    4                    ; pop parameters and return
  4086.   APPLE87     ENDP
  4087.  
  4088.   CODE        ENDS
  4089.  
  4090.               END
  4091.  
  4092.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4093.  
  4094.   UNIT Time;
  4095.  
  4096.   INTERFACE
  4097.  
  4098.   FUNCTION Clock: LONGINT;          { same as VMS; time in milliseconds }
  4099.  
  4100.  
  4101.   IMPLEMENTATION
  4102.  
  4103.   FUNCTION Clock: LONGINT; ASSEMBLER;
  4104.   ASM
  4105.              PUSH    DS            { save caller's data segment }
  4106.              XOR     DX, DX        { initialize data segment to }
  4107.              MOV     DS, DX        {  access ticker counter }
  4108.              MOV     BX, 46Ch      { offset of ticker counter in segm.}
  4109.              MOV     DX, 43h       { timer chip control port }
  4110.              MOV     AL, 4         { freeze timer 0 }
  4111.              PUSHF                 { save caller's int flag setting }
  4112.              STI                   { allow update of ticker counter }
  4113.              LES     DI, DS:[BX]   { read BIOS ticker counter }
  4114.              OUT     DX, AL        { latch timer 0 }
  4115.              LDS     SI, DS:[BX]   { read BIOS ticker counter }
  4116.              IN      AL, 40h       { read latched timer 0 lo-byte }
  4117.              MOV     AH, AL        { save lo-byte }
  4118.              IN      AL, 40h       { read latched timer 0 hi-byte }
  4119.              POPF                  { restore caller's int flag }
  4120.              XCHG    AL, AH        { correct order of hi and lo }
  4121.              MOV     CX, ES        { ticker counter 1 in CX:DI:AX }
  4122.              CMP     DI, SI        { ticker counter updated ? }
  4123.              JE      @no_update    { no }
  4124.              OR      AX, AX        { update before timer freeze ? }
  4125.              JNS     @no_update    { no }
  4126.              MOV     DI, SI        { use second }
  4127.              MOV     CX, DS        {  ticker counter }
  4128.   @no_update:NOT     AX            { counter counts down }
  4129.              MOV     BX, 36EDh     { load multiplier }
  4130.              MUL     BX            { W1 * M }
  4131.              MOV     SI, DX        { save W1 * M (hi) }
  4132.              MOV     AX, BX        { get M }
  4133.              MUL     DI            { W2 * M }
  4134.              XCHG    BX, AX        { AX = M, BX = W2 * M (lo) }
  4135.              MOV     DI, DX        { DI = W2 * M (hi) }
  4136.              ADD     BX, SI        { accumulate }
  4137.              ADC     DI, 0         {  result }
  4138.              XOR     SI, SI        { load zero }
  4139.              MUL     CX            { W3 * M }
  4140.              ADD     AX, DI        { accumulate }
  4141.              ADC     DX, SI        {  result in DX:AX:BX }
  4142.              MOV     DH, DL        { move result }
  4143.              MOV     DL, AH        {  from DL:AX:BX }
  4144.              MOV     AH, AL        {   to }
  4145.              MOV     AL, BH        {    DX:AX:BH }
  4146.              MOV     DI, DX        { save result }
  4147.              MOV     CX, AX        {  in DI:CX }
  4148.              MOV     AX, 25110     { calculate correction }
  4149.              MUL     DX            {  factor }
  4150.              SUB     CX, DX        { subtract correction }
  4151.              SBB     DI, SI        {  factor }
  4152.              XCHG    AX, CX        { result back }
  4153.              MOV     DX, DI        {  to DX:AX }
  4154.              POP     DS            { restore caller's data segment }
  4155.   END;
  4156.  
  4157.  
  4158.   BEGIN
  4159.      Port [$43] := $34;           { need rate generator, not square wave}
  4160.      Port [$40] := 0;             { generator as prog. by some BIOSes }
  4161.      Port [$40] := 0;             { for timer 0 }
  4162.   END. { Time }
  4163.  
  4164.  
  4165.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4166.  
  4167.   {$A+,B-,R-,I-,V-,N+,E+}
  4168.   PROGRAM PeakFlop;
  4169.  
  4170.   USES Time;
  4171.  
  4172.   TYPE ParamRec = RECORD
  4173.                      MaxIter, MaxRad, YMax, XMax: WORD;
  4174.                      Qmax, Qmin, Pmax, Pmin: DOUBLE;
  4175.                      FastMod: WORD;
  4176.                      PlotFkt: POINTER;
  4177.                      FLOPS:LONGINT;
  4178.                   END;
  4179.  
  4180.   VAR Param: ParamRec;
  4181.       Start: LONGINT;
  4182.  
  4183.  
  4184.   {$L APFELM4.OBJ}
  4185.  
  4186.   PROCEDURE Apple87 (VAR Param: ParamRec);     EXTERNAL;
  4187.  
  4188.  
  4189.   BEGIN
  4190.      WITH Param DO BEGIN
  4191.         MaxIter:= 50;
  4192.         MaxRad := 30;
  4193.         YMax   := 30;
  4194.         XMax   := 30;
  4195.         Pmin   :=-2.1;
  4196.         Pmax   := 1.1;
  4197.         Qmin   :=-1.2;
  4198.         Qmax   := 1.2;
  4199.         FastMod:= Word (FALSE);
  4200.         PlotFkt:= NIL;
  4201.         Flops  := 0;
  4202.      END;
  4203.      Start := Clock;
  4204.      Apple87 (Param);         { executes 104002 FLOP }
  4205.      Start := Clock - Start;  { elapsed time in milliseconds }
  4206.      WriteLn ('Peak-MFLOPS: ', 104.002 / Start);
  4207.   END.
  4208.  
  4209.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4210.  
  4211.   ; FILE: M4X4.ASM
  4212.   ;
  4213.   ; assemble with TASM /e M4X4 or MASM /e M4X4
  4214.  
  4215.   CODE      SEGMENT BYTE PUBLIC 'CODE'
  4216.  
  4217.             ASSUME  CS:CODE
  4218.  
  4219.             PUBLIC  MUL_4x4
  4220.             PUBLIC  IIT_MUL_4x4
  4221.  
  4222.  
  4223.   FSBP0     EQU     DB  0DBh, 0E8h        ; declare special IIT
  4224.   FSBP1     EQU     DB  0DBh, 0EBh        ;  instructions
  4225.   FSBP2     EQU     DB  0DBh, 0EAh
  4226.   F4X4      EQU     DB  0DBh, 0F1h
  4227.  
  4228.  
  4229.   ;---------------------------------------------------------------------
  4230.   ;
  4231.   ; MUL_4x4 multiplicates a four-by-four matrix by an array of four
  4232.   ; dimensional vectors. This operation is needed for 3D transformations
  4233.   ; in graphics data processing. There are arrays for each component of
  4234.   ; a vector. Thus there is an ; array containing all the x components,
  4235.   ; another containing all the y components and so on. Each component is
  4236.   ; an 8 byte IEEE floating-point number. Two indices into the array of
  4237.   ; vectors are given. The first is the index of the vector that will be
  4238.   ; processed first, the second is the index of the vector processed
  4239.   ; last.
  4240.   ;
  4241.   ;---------------------------------------------------------------------
  4242.  
  4243.   MUL_4x4   PROC    NEAR
  4244.  
  4245.             AddrX   EQU DWORD PTR [BP+24] ; address of X component array
  4246.             AddrY   EQU DWORD PTR [BP+20] ; address of Y component array
  4247.             AddrZ   EQU DWORD PTR [BP+16] ; address of Z component array
  4248.             AddrW   EQU DWORD PTR [BP+12] ; address of W component array
  4249.             AddrT   EQU DWORD PTR [BP+8]  ; addr. of 4x4 transform. mat.
  4250.             F       EQU WORD  PTR [BP+6]  ; first vector to process
  4251.             K       EQU WORD  PTR [BP+4]  ; last vector to process
  4252.             RetAddr EQU WORD  PTR [BP+2]  ; return address saved by call
  4253.             SavdBP  EQU WORD  PTR [BP+0]  ; saved frame pointer
  4254.             SavdDS  EQU WORD  PTR [BP-2]  ; caller's data segment
  4255.  
  4256.             PUSH    BP                    ; save TURBO-Pascal frame ptr
  4257.             MOV     BP, SP                ; new frame pointer
  4258.             PUSH    DS                    ; save TURBO-Pascal data segmnt
  4259.  
  4260.             MOV     CX, K                 ; final index
  4261.             SUB     CX, F                 ; final index - start index
  4262.             JNC     $ok                   ; must not
  4263.             JMP     $nothing              ;  be negative
  4264.   $ok:      INC     CX                    ; number of elements
  4265.  
  4266.             MOV     SI, F                 ; init offset into arrays
  4267.             SHL     SI, 1                 ; each
  4268.             SHL     SI, 1                 ;  element
  4269.             SHL     SI, 1                 ;   has 8 bytes
  4270.  
  4271.             LDS     DI, AddrT             ; addr. of transformation mat.
  4272.             FLD     QWORD PTR [DI]        ; load a[0,0]   = R7
  4273.             FLD     QWORD PTR [DI+8]      ; load a[0,1]   = R6
  4274.  
  4275.   $mat_mul: LES     BX, AddrX             ; addr. of x component array
  4276.             FLD     QWORD PTR ES:[BX+SI]  ; load x[a]     = R5
  4277.             LES     BX, AddrY             ; addr. of y component array
  4278.             FLD     QWORD PTR ES:[BX+SI]  ; load y[a]     = R4
  4279.             LES     BX, AddrZ             ; addr. of z component array
  4280.             FLD     QWORD PTR ES:[BX+SI]  ; load z[a]     = R3
  4281.             LES     BX, AddrW             ; addr. of w component array
  4282.             FLD     QWORD PTR ES:[BX+SI]  ; load w[a]     = R2
  4283.  
  4284.             FLD     ST(5)                 ; load a[0,0]   = R1
  4285.             FMUL    ST, ST(4)             ; a[0,0] * x[a] = R1
  4286.             FLD     ST(5)                 ; load a[0,1]   = R0
  4287.             FMUL    ST, ST(4)             ; a[0,1] * y[a] = R0
  4288.             FADDP   ST(1), ST             ; a[0,0]*x[a]+a[0,1]*y[a]=R1
  4289.             FLD     QWORD PTR [DI+16]     ; load a[0,2]   = R0
  4290.             FMUL    ST, ST(3)             ; a[0,2] * z[a] = R0
  4291.             FADDP   ST(1), ST             ; a[0,0]*x[a]...a[0,2]*z[a]=R1
  4292.             FLD     QWORD PTR [DI+24]     ; load a[0,3]   = R0
  4293.             FMUL    ST, ST(2)             ; a[0,3] * w[a] = R0
  4294.             FADDP   ST(1), ST             ; a[0,0]*x[a]...a[0,3]*w[a]=R1
  4295.             LES     BX, AddrX             ; get address of x vector
  4296.             FSTP    QWORD PTR ES:[BX+SI]  ; write new x[a]
  4297.  
  4298.             FLD     QWORD PTR [DI+32]     ; load a[1,0]   = R1
  4299.             FMUL    ST, ST(4)             ; a[1,0] * x[a] = R1
  4300.             FLD     QWORD PTR [DI+40]     ; load a[1,1]   = R0
  4301.             FMUL    ST, ST(4)             ; a[1,1] * y[a] = R0
  4302.             FADDP   ST(1), ST             ; a[1,0]*x[a]+a[1,1]*y[a]=R1
  4303.             FLD     QWORD PTR [DI+48]     ; load a[1,2]   = R0
  4304.             FMUL    ST, ST(3)             ; a[1,2] * z[a] = R0
  4305.             FADDP   ST(1), ST             ; a[1,0]*x[a]...a[1,2]*z[a]=R1
  4306.             FLD     QWORD PTR [DI+56]     ; load a[1,3]   = R0
  4307.             FMUL    ST, ST(2)             ; a[1,3] * w[a] = R0
  4308.             FADDP   ST(1), ST             ; a[1,0]*x[a]...a[1,3]*w[a]=R1
  4309.             LES     BX, AddrY             ; get address of y vector
  4310.             FSTP    QWORD PTR ES:[BX+SI]  ; write new y[a]
  4311.  
  4312.             FLD     QWORD PTR [DI+64]     ; load a[2,0]   = R1
  4313.             FMUL    ST, ST(4)             ; a[2,0] * x[a] = R1
  4314.             FLD     QWORD PTR [DI+72]     ; load a[2,1]   = R0
  4315.             FMUL    ST, ST(4)             ; a[2,1] * y[a] = R0
  4316.             FADDP   ST(1), ST             ; a[2,0]*x[a]+a[2,1]*y[a]=R1
  4317.             FLD     QWORD PTR [DI+80]     ; load a[2,2]   = R0
  4318.             FMUL    ST, ST(3)             ; a[2,2] * z[a] = R0
  4319.             FADDP   ST(1), ST             ; a[2,0]*x[a]...a[2,2]*z[a]=R1
  4320.             FLD     QWORD PTR [DI+88]     ; load a[2,3]   = R0
  4321.             FMUL    ST, ST(2)             ; a[2,3] * w[a] = R0
  4322.             FADDP   ST(1), ST             ; a[2,0]*x[a]...a[2,3]*w[a]=R1
  4323.             LES     BX, AddrZ             ; get address of z vector
  4324.             FSTP    QWORD PTR ES:[BX+SI]  ; write new z[a]
  4325.  
  4326.             FLD     QWORD PTR [DI+96]     ; load a[3,0]   = R1
  4327.             FMULP   ST(4), ST             ; a[3,0] * x[a] = R5
  4328.             FLD     QWORD PTR [DI+104]    ; load a[3,1]   = R1
  4329.             FMULP   ST(3), ST             ; a[3,1] * y[a] = R4
  4330.             FLD     QWORD PTR [DI+112]    ; load a[3,2]   = R1
  4331.             FMULP   ST(2), ST             ; a[3,2] * z[a] = R3
  4332.             FLD     QWORD PTR [DI+120]    ; load a[3,3]   = R1
  4333.             FMULP   ST(1), ST             ; a[3,3] * w[a] = R2
  4334.             FADDP   ST(1), ST             ; a[3,3]*w[a]+a[3,2]*z[a]=R3
  4335.             FADDP   ST(1), ST             ; a[3,3]*w[a]...a[3,1]*y[a]=R4
  4336.             FADDP   ST(1), ST             ; a[3,3]*w[a]...a[3,0]*x[a]=R5
  4337.             LES     BX, AddrW             ; get address of w vector
  4338.             FSTP    QWORD PTR ES:[BX+SI]  ; write new w[a]
  4339.  
  4340.             ADD     SI, 8                 ; new offset into arrays
  4341.             DEC     CX                    ; decrement element counter
  4342.             JZ      $done                 ; no elements left, done
  4343.             JMP     $mat_mul              ; transform next vector
  4344.  
  4345.   $done:    FSTP     ST(0)                ; clear
  4346.             FSTP     ST(0)                ;  FPU stack
  4347.   $nothing: POP      DS                   ; restore TP data segment
  4348.             POP      BP                   ; restore TP frame pointer
  4349.             RET      24                   ; pop parameters and return
  4350.  
  4351.   MUL_4X4   ENDP
  4352.  
  4353.  
  4354.   ;---------------------------------------------------------------------
  4355.   ;
  4356.   ; IIT_MUL_4x4 multiplicates a four-by-four matrix by an array of four
  4357.   ; dimensional vectors. This operation is needed for 3D transformations
  4358.   ; in graphics data processing. There are arrays for each component of
  4359.   ; a vector.  Thus there is an array containing all the x components,
  4360.   ; another containing all the y components and so on. Each component is
  4361.   ; an 8 byte IEEE floating-point number. Two indices into the array of
  4362.   ; vectors are given. The first is the index of the vector that will be
  4363.   ; processed first, the second is the index of the vector processed
  4364.   ; last. This subroutine uses the special instructions only available
  4365.   ; on IIT coprocessors to provide fast matrix multiply capabilities.
  4366.   ; So make sure to use it only on IIT coprocessors.
  4367.   ;
  4368.   ;---------------------------------------------------------------------
  4369.  
  4370.   IIT_MUL_4x4   PROC    NEAR
  4371.  
  4372.             AddrX   EQU DWORD PTR [BP+24] ; address of X component array
  4373.             AddrY   EQU DWORD PTR [BP+20] ; address of Y component array
  4374.             AddrZ   EQU DWORD PTR [BP+16] ; address of Z component array
  4375.             AddrW   EQU DWORD PTR [BP+12] ; address of W component array
  4376.             AddrT   EQU DWORD PTR [BP+8]  ; addr. of 4x4 transf. matrix
  4377.             F       EQU WORD  PTR [BP+6]  ; first vector to process
  4378.             K       EQU WORD  PTR [BP+4]  ; last vector to process
  4379.             RetAddr EQU WORD  PTR [BP+2]  ; return address saved by call
  4380.             SavdBP  EQU WORD  PTR [BP+0]  ; saved frame pointer
  4381.             SavdDS  EQU WORD  PTR [BP-2]  ; caller's data segment
  4382.             Ctrl87  EQU WORD  PTR [BP-4]  ; caller's 80x87 control word
  4383.  
  4384.             PUSH    BP                    ; save TURBO-Pascal frame ptr
  4385.             MOV     BP, SP                ; new frame pointer
  4386.             PUSH    DS                    ; save TURBO-Pascal data seg.
  4387.             SUB     SP, 2                 ; make local variabe
  4388.             FSTCW   [Ctrl87]              ; save 80x87 ctrl word
  4389.             LES     SI, AddrT             ; ptr to transformation matrix
  4390.             FINIT                         ; initialize coprocessor
  4391.             FSBP2                         ; set register bank 2
  4392.             FLD     QWORD PTR ES:[SI]     ; load a[0,0]
  4393.             FLD     QWORD PTR ES:[SI+32]  ; load a[1,0]
  4394.             FLD     QWORD PTR ES:[SI+64]  ; load a[2,0]
  4395.             FLD     QWORD PTR ES:[SI+96]  ; load a[3,0]
  4396.             FLD     QWORD PTR ES:[SI+8]   ; load a[0,1]
  4397.             FLD     QWORD PTR ES:[SI+40]  ; load a[1,1]
  4398.             FLD     QWORD PTR ES:[SI+72]  ; load a[2,1]
  4399.             FLD     QWORD PTR ES:[SI+104] ; load a[3,1]
  4400.             FINIT                         ; initialize coprocessor
  4401.             FSBP1                         ; set register bank 1
  4402.             FLD     QWORD PTR ES:[SI+16]  ; load a[0,2]
  4403.             FLD     QWORD PTR ES:[SI+48]  ; load a[1,2]
  4404.             FLD     QWORD PTR ES:[SI+80]  ; load a[2,2]
  4405.             FLD     QWORD PTR ES:[SI+112] ; load a[3,2]
  4406.             FLD     QWORD PTR ES:[SI+24]  ; load a[0,3]
  4407.             FLD     QWORD PTR ES:[SI+56]  ; load a[1,3]
  4408.             FLD     QWORD PTR ES:[SI+88]  ; load a[2,3]
  4409.             FLD     QWORD PTR ES:[SI+120] ; load a[3,3]
  4410.  
  4411.                                           ; transformation matrix loaded
  4412.  
  4413.             MOV     AX, F                 ; index of first vector
  4414.             MOV     DX, K                 ; index of last vector
  4415.  
  4416.             MOV     BX, AX                ; index 1st vector to process
  4417.             MOV     CL, 3                 ; component has 8 (2**3) bytes
  4418.             SHL     BX, CL                ; compute offset into arrays
  4419.  
  4420.             FINIT                         ; initialize coprocessor
  4421.             FSBP0                         ; set register bank 0
  4422.  
  4423.   $mat_loop:LES     SI, AddrW             ; addr. of W component array
  4424.             FLD     QWORD PTR ES:[SI+BX]  ; W component current vector
  4425.             LES     SI, AddrZ             ; addr. of Z component array
  4426.             FLD     QWORD PTR ES:[SI+BX]  ; Z component current vector
  4427.             LES     SI, AddrY             ; addr. of Y component array
  4428.             FLD     QWORD PTR ES:[SI+BX]  ; Y component current vector
  4429.             LES     SI, AddrX             ; addr. of X component array
  4430.             FLD     QWORD PTR ES:[SI+BX]  ; X component current vector
  4431.             F4X4                          ; mul 4x4 matrix by 4x1 vector
  4432.             INC     AX                    ; next vector
  4433.             MOV     DI, AX                ; next vector
  4434.             SHL     DI, CL                ; offset of vector into arrays
  4435.  
  4436.             FSTP    QWORD PTR ES:[SI+BX]  ; store X comp. of curr. vect.
  4437.             LES     SI, AddrY             ; address of Y component array
  4438.             FSTP    QWORD PTR ES:[SI+BX]  ; store Y comp. of curr. vect.
  4439.             LES     SI, AddrZ             ; address of Z component array
  4440.             FSTP    QWORD PTR ES:[SI+BX]  ; store Z comp. of curr. vect.
  4441.             LES     SI, AddrW             ; address of W component array
  4442.             FSTP    QWORD PTR ES:[SI+BX]  ; store W comp. of curr. vect.
  4443.  
  4444.             MOV     BX, DI                ; ofs nxt vect. in comp. arrays
  4445.             CMP     AX, DX                ; nxt vector past upper bound?
  4446.             JLE     $mat_loop             ; no, transform next vector
  4447.             FLDCW   [Ctrl87]              ; restore orig 80x87 ctrl word
  4448.  
  4449.             ADD      SP, 2                ; get rid of local variable
  4450.             POP      DS                   ; restore TP data segment
  4451.             POP      BP                   ; restore TP frame pointer
  4452.             RET      24                   ; pop parameters and return
  4453.   IIT_MUL_4x4   ENDP
  4454.  
  4455.   CODE      ENDS
  4456.  
  4457.             END
  4458.  
  4459.   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4460.  
  4461.   {$N+,E+}
  4462.  
  4463.   PROGRAM Trnsform;
  4464.  
  4465.   USES Time;
  4466.  
  4467.   CONST VectorLen = 8190;
  4468.  
  4469.   TYPE  Vector    = ARRAY [0..VectorLen] OF DOUBLE;
  4470.         VectorPtr = ^Vector;
  4471.         Mat4      = ARRAY [1..4, 1..4] OF DOUBLE;
  4472.  
  4473.   VAR   X: VectorPtr;
  4474.         Y: VectorPtr;
  4475.         Z: VectorPtr;
  4476.         W: VectorPtr;
  4477.         T: Mat4;
  4478.         K: INTEGER;
  4479.         L: INTEGER;
  4480.         First: INTEGER;
  4481.         Last:  INTEGER;
  4482.         Start: LONGINT;
  4483.         Elapsed:LONGINT;
  4484.  
  4485.   PROCEDURE MUL_4X4     (X, Y, Z, W: VectorPtr;
  4486.                          VAR T: Mat4; First, Last: INTEGER); EXTERNAL;
  4487.   PROCEDURE IIT_MUL_4X4 (X, Y, Z, W: VectorPtr;
  4488.                          VAR T: Mat4; First, Last: INTEGER); EXTERNAL;
  4489.  
  4490.   {$L M4X4.OBJ}
  4491.  
  4492.   BEGIN
  4493.      WriteLn ('Test8087 = ', Test8087);
  4494.      New (X);
  4495.      New (Y);
  4496.      New (Z);
  4497.      New (W);
  4498.      FOR L := 1 TO VectorLen DO BEGIN
  4499.         X^ [L] := Random;
  4500.         Y^ [L] := Random;
  4501.         Z^ [L] := Random;
  4502.         W^ [L] := Random;
  4503.      END;
  4504.      X^ [0] := 1;
  4505.      Y^ [0] := 1;
  4506.      Z^ [0] := 1;
  4507.      W^ [0] := 1;
  4508.      FOR K := 1 TO 4 DO BEGIN
  4509.         FOR L := 1 TO 4 DO BEGIN
  4510.            T [K, L] := (K-1)*4 + L;
  4511.         END;
  4512.      END;
  4513.      First := 0;
  4514.      Last  := 8190;
  4515.      Start := Clock;
  4516.      MUL_4X4 (X, Y, Z, W, T, First, Last);
  4517.      { IIT_MUL_4X4 (X, Y, Z, W, T, First, Last); }
  4518.      Elapsed := Clock - Start;
  4519.      WriteLn ('Number of vectors: ', Last-First+1);
  4520.      WriteLn ('Time: ', Elapsed, ' ms');
  4521.      WriteLn ('Equivalent to ', (28.0*(Last-First+1)/1e6)/
  4522.               (Elapsed*1e-3):0:4, ' MFLOPS');
  4523.      WriteLn;
  4524.      WriteLn ('Last vector:');
  4525.      WriteLn;
  4526.      WriteLn (X^[Last]);
  4527.      WriteLn (Y^[Last]);
  4528.      WriteLn (Z^[Last]);
  4529.      WriteLn (W^[Last]);
  4530.   END
  4531.